I've got an issue with the persist operation, when I use a detached entity as
one of the entity's referenced entities.
OpenJPA throws the
org.apache.openjpa.persistence.EntityExistsException: Attempt to persist
detached object
"[EMAIL PROTECTED]".
The situation is this: my MVC layer has received a new entity which it must
create. The parent entity for this is found in a cache, in a detached state.
What I'd like to know, is why is JPA forcing me to merge this detached entity
before allowing me to persist the new child?
It means I can't use the cache, or I have to program the DAO to merge all
referenced entities. This latter option seems like a job that JPA should be
doing. JPA knows this parent is a detached entity, so why can't it merge the
managed entity?
I can't see any text in the EJB spec that would mandate this behaviour, yet
Hibernate does it too.
Regards
Adam
- persisting an entity and JPA behaviour with referenced entiti... Adam Hardy
-