Home » Support » Forum » EntityManager.merge gives EntityNotFoundException

EntityManager.merge gives EntityNotFoundException

#1

Just started using objectdb (2.3.4). Calling EntityManager.merge for a new (non-managed) object gives EntityNotFoundException. I am perplexed by this. See attached test case. Thanks for your assistance.

Full error output is:

Exception in thread "main" [ObjectDB 2.3.4] javax.persistence.EntityNotFoundException
Entity is not found: classdb.Test#'id' (error 631)
at com.objectdb.jpa.EMImpl.merge(EMImpl.java:456)
at classdb.Test.main(Test.java:32)

#2

You are right, merging non managed (new) entity objects has to be supported in this case. Till now it was supported only for new non managed entity objects with no primary key (which is generated automatically or set after merge), and build 2.3.4_01 fixes it.

Notice, however, that persist is more efficient than merge in this case, since merge requires looking for the object in the database.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login