| Existing managed object being inserted [message #547211] |
Thu, 15 July 2010 19:45  |
Fericit Bostan Messages: 68 Registered: June 2010 |
Member |
|
|
I'm running in GlassFish 3.0.1 with EclipseLink 2.0.1 and Spring 3.0. I've got an EJB that is a WebService that has a create method on it which the client calls after retrieving an existing object from the service on a previous call. My code walks the object graph to identify the existing objects in the persistence store and performs lookups for those objects and then associates them to the objects that are to be inserted. All this work is performed within a transaction.
I actually have two issues. The first is that two of the objects that are retrieved from the persistence store contain the same Id, but the EntityManager is returning two different instances of the entity.
The second issue, which is much bigger, is that one entity that is retrieved from the persistence store, EclipseLink is attempting to insert it into the database. This causes a Violation of a Unique constraint in the database, but why would EclipseLink be trying to insert an entity that it currently manages?
The attached link is to my GlassFish servers log file. I enabled logging on EclipseLink and the TransactionManager in hopes of trying to identify the issue.
Thanks for the help.
http://dl.dropbox.com/u/601181/glassfish-eclipselink-exception.log
|
|
|
| Re: Existing managed object being inserted [message #550836 is a reply to message #547211] |
Wed, 04 August 2010 09:31  |
James Sutherland Messages: 1834 Registered: July 2009 |
Senior Member |
|
|
Very odd. Seems like Spring may not be integrated with transactions correctly and is returning a different EntityManager on every call.
Maybe try isolated the issue and remove Spring from the picture.
Does this occur for all of your classes, or just one?
Perhaps include the code for the class and create method.
James : Wiki : Book : Blog
|
|
|
Powered by
FUDForum. Page generated in 0.01746 seconds