Skip to content

Commit

Permalink
fix: QueryedRecord cannot be used for save/update
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Nov 1, 2023
1 parent a6d7ff3 commit 0b293fa
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public PersistManagerFactory getPersistManagerFactory() {
@Override
public Record save(final Record record) throws DataAccessException {
Validate.isTrue(record.getPrimary() == null);
Validate.isTrue(record instanceof QueryedRecord, "QueryedRecord cannot be used for save");
Validate.isTrue(!(record instanceof QueryedRecord), "QueryedRecord cannot be used for save");

Entity e = record.getEntity();
return saveInternal(record, ID.newId(e.getEntityCode()));
Expand Down Expand Up @@ -134,7 +134,7 @@ public Object doInParameters(PreparedStatement pstmt) {
@Override
public Record update(final Record record) throws DataAccessException {
Validate.notNull(record.getPrimary());
Validate.isTrue(record instanceof QueryedRecord, "QueryedRecord cannot be used for update");
Validate.isTrue(!(record instanceof QueryedRecord), "QueryedRecord cannot be used for update");

Entity e = record.getEntity();

Expand Down

0 comments on commit 0b293fa

Please sign in to comment.