merge « Glassfish « JPA Q&A





1. ID value already provided when calling merge with OpenJPA and WebSphere 7    stackoverflow.com

Some basic information:

  • WebSphere 7.0.0.13 (with JPA 2.0 fix)
  • OpenJPA 2.0.1
  • Spring 3.0.5
  • SQL Server 2008
I have an entity as follows:
public class QuestionnaireClient {

/* --- Members --- */

/** The unique, internal ID of the entity. ...

2. JPA merge specification    java.net

"If X is an entity merged to X', with a reference to another entity Y, where cascade=MERGE or cascade=ALL is not specified, then navigation of the same association from X' yields a reference to a managed object Y' with the same persistent identity as Y."OK, but what state (the values of the persistent field) for Y' ?

3. JPA Merge and Remove    java.net

Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b45-beta3 (05/03/2007))): oracle.toplink.essentials.exceptions.DatabaseException Internal Exception: java.sql.SQLIntegrityConstraintViolationException: DELETE on table 'VEHICLE' caused a violation of foreign key constraint 'BSCDTTRGTCPLCPLNGD' for key (202). The statement has been rolled back. Error Code: 20000 Call: DELETE FROM VEHICLE WHERE (VEHICLEID = ?) bind => [202] Query: DeleteObjectQuery(Vehicle Car) oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:296) oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:639) oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:688) ... MainProgramManagement.ProgramMain.removeData(ProgramMain.java:830)

4. JPA merge creating new record    java.net

Now, I have read that if the EntityManager does not have track of an entity with the given ID, it will create a new one. So, thinking that this in-and-out-of-hashtable operation might cause the EM to lose track of the entities (for some reason), I've created a simple test program as well, to ensure the EntityManager DOES know about an entity. ...