Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Existing managed object being inserted
Existing managed object being inserted [message #547211] Thu, 15 July 2010 23:45 Go to next message
Fericit Bostan is currently offline 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 13:31 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
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 : Twitter
Previous Topic:BatchUpdateException: invalid batch command: invalid SELECT batch command 0
Next Topic:Attribute.isAssociation in metamodel API returns false for relationship mappings
Goto Forum:
  


Current Time: Sat Sep 20 14:17:33 GMT 2014

Powered by FUDForum. Page generated in 0.01571 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software