users@glassfish.java.net

Re: Desparately need help with JPA (Toplink) cache problems

From: <glassfish_at_javadesktop.org>
Date: Thu, 24 Jul 2008 12:16:18 PDT

Hello,

From the log, it looks like the application is reading in an object that references the Chassis9145ConfigSet id=428, and then attempting remove it from the database. Later on, another read is performed and the same Chassis9145ConfigSet id=428 is found referenced and it is again attempted to be removed from the database, causing the exception.

My guess is that when the application calls em.remove on the Chassis9145ConfigSet entity, it is not clearing all references to it. Later on, when an entity is read in from the cache that is left referencing it, this causes it to become managed as if it still exists. If this is the case, this is covered by the specification - the application is required to clear all references to objects before they are removed. I would start with checking the Chassis9145 object that is read in, as I suspect it has a 1:M to Chassis9145ConfigSet.

Depending on the order objects are checked for changes, leaving references to deleted objects might get you this issue, or might cause them to be 'undeleted' in the same transaction - resulting in the delete statement not being issued.

Best regards,
Chris
[Message sent by forum member 'chris_delahunt' (chris_delahunt)]

http://forums.java.net/jive/thread.jspa?messageID=289156