Reputation: 3050
If entity is deleted or managed it is stored (or its hash) in current EntityManger's persistence context, so JPA know about its state. But how JPA implementation can get to know that given entity is new or detached? Checking if @ID is null will not always work. Is it JPA provider specific?
In other words how JPA know that it need to throw javax.persistence.EntityExistsException
during merging?
Upvotes: 1
Views: 1120
Reputation: 692131
Here's how Hibernate does it:
Upvotes: 2