persistence@glassfish.java.net

Re: java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST.

From: Jon Miller <jemiller_at_uchicago.edu>
Date: Thu, 11 Jan 2007 11:50:54 -0600

Mitesh,

Thanks for the super fast enhancement on this. Much appreciated. Are there
nightly binary builds, or, do you have to build it from the source? If the
later, I'm wondering which projects I need to check out. I tried building
from the source once before, but, from what I remember, I needed something
more than just the persistence project.

Jon

----- Original Message -----
From: "Mitesh Meswani" <Mitesh.Meswani_at_Sun.COM>
To: <persistence_at_glassfish.dev.java.net>
Sent: Wednesday, January 10, 2007 8:02 PM
Subject: Re: java.lang.IllegalStateException: During synchronization a new
object was found through a relationship that was not marked cascade PERSIST.


> Hi Jon,
>
> A fix has been checked in
> <https://glassfish.dev.java.net/source/browse/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/localization/i18n/ExceptionLocalizationResource.java?r1=1.14&r2=1.15>.
> The error message now includes the offending object. Today's nightly
> should contain the fix. Typically you get into this situation if you are
> not maintaining both sides of your relationships. For example if you have
> a domain model with Department and Employee with a bidirectional
> relationship, if you do emp.setDepartment(newDepartment), you will need to
> make sure to remove the employee from its old department's employees
> collection and add it to newDeapartment's employee collection.
>
> -Mitesh
>
>
> Jon Miller wrote:
>> Hi all,
>>
>> I'm running into the following exception. I'm wondering if anyone has
>> suggestions on how to find the offending object? I'm thinking it might be
>> nice if the error message did something like print the toString()
>> representation of the offending object.
>>
>> Caused by: javax.faces.el.EvaluationException:
>> javax.persistence.RollbackException: java.lang.IllegalStateException:
>> During synchronization a new object was found through a relationship that
>> was not marked cascade PERSIST.
>>
>> Jon
>