|Building object hierarchy causes synchronization [message #547133]
||Thu, 15 July 2010 16:20
| Fericit Bostan
Registered: June 2010
I'm using EclipseLink 2.0 with GlassFish 3.0.1 and running inside of a global transaction. I'm invoking a WebService/EJB that takes an object graph that I want to persist but need to assign the proper associations prior. In my WebService method, which is Transactional, I loop through a collection of objects owned by the parent. These objects in turn have collections and so on ... Prior to persisting these objects I need to perform lookups of existing objects and make the appropriate assignments. |
The problem that I'm having is running through the first loop I manage to locate the objects and make the assignments. On the next iteration, when I perform a lookup for an existing object it causes the EntityManager to perform a synchronization and the new objects that have been associated to the managed objects are now trying to be persisted. Of course not all of my associations are complete and I get an exception due to a null value in a require association.
During synchronization a new object was found through a relationship that was not marked cascade PERSIST: com.soma.survey.entity.Answer[answerid=null].
So how do I prevent the EntityManager from performing the synchronization? Or should I be attempting this type of effort in a different fashion?
Thank you for the help...
Powered by FUDForum
. Page generated in 0.01694 seconds