Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Existing managed object being inserted
Existing managed object being inserted [message #547211] Thu, 15 July 2010 19:45 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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.
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: Sun Jul 06 18:46:35 EDT 2025

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

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

Back to the top