Skip to content

Commit

Permalink
Improve "new entity detection"
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanpelikan committed Mar 14, 2024
1 parent cf20057 commit 6719e82
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ public <O> boolean isPersistedEntity(

final var em = jpaContext
.getEntityManagerByManagedType(entityClass);
return em.contains(entity);
if (em.contains(entity)) {
return true;
}
return em.find(entityClass, getId(entity)) != null;

}

Expand Down

0 comments on commit 6719e82

Please sign in to comment.