You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Daryl Stultz <da...@6degrees.com> on 2009/08/28 14:15:23 UTC
SingleFieldManager.preFlushPC
Hello,
I've tried unsuccessfully to get help from the users' list. Hopefully
someone here can shed some light.
I'm getting this error:
org.apache.openjpa.persistence.InvalidStateException: Encountered unmanaged
object in persistent field "blah.model.MyEntity.anotherEntity" during flush.
However, this field does not allow cascade persist. Set the cascade
attribute for this field to CascadeType.PERSIST or CascadeType.ALL (JPA
annotations) or "persist" or "all" (JPA orm.xml), or enable cascade-persist
globally, or manually persist the related field value prior to flushing. You
cannot flush unmanaged objects or graphs that have persistent associations
to unmanaged objects.
FailedObject: blah.model.AnotherEntity-1981
at
org.apache.openjpa.kernel.SingleFieldManager.preFlushPC(SingleFieldManager.java:754)
at
org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:594)
SingleFieldManager.preFlushPC looks like this, with the last line throwing
my exception:
OpenJPAStateManager sm;
*if* (vmd.getCascadePersist() == ValueMetaData.*CASCADE_NONE*) {
*if* (!_broker.isDetachedNew() && _broker.isDetached(obj))
*return*; // allow but ignore
sm = _broker.getStateManager(obj);
*if* (sm == *null* || !sm.isPersistent())
*throw* *new* InvalidStateException(
*_loc*.get("cant-cascade-persist", vmd))
.setFailedObject(obj);
I can't reproduce the problem, so I don't know if sm is null or sm is not
persistent. I have 2 questions that are maybe the same: what condition leads
to sm being null or not persistent and what exactly is an "unmanaged"
object?
Thanks.
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com
Re: SingleFieldManager.preFlushPC
Posted by Daryl Stultz <da...@6degrees.com>.
On Fri, Sep 4, 2009 at 8:59 AM, Daryl Stultz <da...@6degrees.com> wrote:
Can I get someone to comment on this?
> Does this look like it should work or fail:
>
> EntityManager em = getEntityManager();
> A a = em.find(A.class, 1);
> em.close();
> em = getEntityManager();
> B b = em.find(B.class, 2);
> em.close();
> em = getEntityManager();
> a.setB(b); // presuming this is a different B value than before
> em.merge(a);
>
> The property "b" on "a" is not set to Cascade. How about this:
>
> EntityManager em = getEntityManager();
> B b = em.find(B.class, 2);
> em.close();
> em = getEntityManager();
> A a = new A();
> a.setB(b);
> em.persist(a);
>
> This is the general idea to what I'm doing, though the object graph is a
> bit more complicated. I'm still trying to understand what state "b" is
> expected to be in if I'm not using CascadeType.PERSIST/MERGE.
>
> Thanks.
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com
Re: SingleFieldManager.preFlushPC
Posted by Daryl Stultz <da...@6degrees.com>.
On Fri, Aug 28, 2009 at 1:35 PM, Michael Dick <mi...@gmail.com>wrote:
> On Fri, Aug 28, 2009 at 11:40 AM, Daryl Stultz <da...@6degrees.com> wrote:
> > Does this mean an object that has *never* been associated with an em, or
> > one
> > that is not *currently* associated? Are you referring only to "new"
> > objects?
> > Is a detached instance "unmanaged"?
> >
>
> Both Entities that have never been associated with an EM and those which
> are
> not currently associated with an EM are considered unmanaged.
>
> Put another way unmanaged == OpenJPA is not tracking the changes you make
> to
> the entity. So new entities and detached entities are unmanaged.
>
> I thought changes were tracked if the instance has a state manager. Is a
detached entity with a state manager considered unmanaged?
Does this look like it should work or fail:
EntityManager em = getEntityManager();
A a = em.find(A.class, 1);
em.close();
em = getEntityManager();
B b = em.find(B.class, 2);
em.close();
em = getEntityManager();
a.setB(b); // presuming this is a different B value than before
em.merge(a);
The property "b" on "a" is not set to Cascade. How about this:
EntityManager em = getEntityManager();
B b = em.find(B.class, 2);
em.close();
em = getEntityManager();
A a = new A();
a.setB(b);
em.persist(a);
This is the general idea to what I'm doing, though the object graph is a bit
more complicated. I'm still trying to understand what state "b" is expected
to be in if I'm not using CascadeType.PERSIST/MERGE.
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com
Re: SingleFieldManager.preFlushPC
Posted by Daryl Stultz <da...@6degrees.com>.
On Wed, Sep 2, 2009 at 11:31 AM, Donald Woods <dw...@apache.org> wrote:
> What version of OpenJPA are you using (I didn't see it mentioned in the
> email thread)?
>
> Can you post more details of the entities being used, like the orm.xml,
> persistence.xml, relationships, build vs. runtime enhancement, which
> version/vendor of Java, ....
>
>
OpenJPA 1.2.1
Java 1.5.0_07 (Sun)
PostgreSQL 8.3.7
Linux 2.6 / Fedora Core 5
build time enhancement
I don't use orm.xml and metadata is annotations. Properties are
<property name="openjpa.LockManager" value="none" />
<property name="openjpa.DetachState" value="loaded(AccessUnloaded=false)" />
A simplified version of the object graph looks like this:
TimeTrackingEntry
User addedBy
User modifiedBy
TimeCardSwipeEvent inTimeCardSwipeEvent
TimeCardSwipeEvent outTimeCardSwipeEvent
List<RoleTimeCredit> roleTimeCredits (CascadeType.ALL)
TimeCardSwipeEvent
User user
TimeTrackingEntry inTimeTrackingEntry
TimeTrackingEntry outTimeTrackingEntry
RoleTimeCredit
TimeTrackingEntry timeTrackingEntry
User user
User modifiedBy
User addedBy
The first addedBy and inTimeCardSwipeEvent are the properties that failed.
It's possible I have the same relationship as that described by JIRA OPENJPA
714. As stated, the error happens rarely. I don't want to post my source
code here but I can send it to you directly if you think it will help.
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com
Re: SingleFieldManager.preFlushPC
Posted by Donald Woods <dw...@apache.org>.
What version of OpenJPA are you using (I didn't see it mentioned in the
email thread)?
Can you post more details of the entities being used, like the orm.xml,
persistence.xml, relationships, build vs. runtime enhancement, which
version/vendor of Java, ....
-Donald
Daryl Stultz wrote:
> On Mon, Aug 31, 2009 at 1:44 PM, Donald Woods <dw...@apache.org> wrote:
>
>> Are there any timeout, deadlock or resource contention errors on the DB
>> side?
>>
>> Not that I can see any evidence of. Nothing in logs and db is not throwing
> an error related to it. There are some queries that take several seconds to
> read the main table which is related to the table failing but they aren't
> especially tight. How might I go about inducing a condition that could cause
> a problem (IOW, in what situation would a long read/deadlock cause this
> error?)
>
> Thanks.
>
Re: SingleFieldManager.preFlushPC
Posted by Daryl Stultz <da...@6degrees.com>.
On Mon, Aug 31, 2009 at 4:00 PM, Daryl Stultz <da...@6degrees.com> wrote:
<something>
Just bumping this thread. I'm hoping Kevin, Mike or Don can answer some of
the questions I still have.
Thanks.
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com
Re: SingleFieldManager.preFlushPC
Posted by Daryl Stultz <da...@6degrees.com>.
On Mon, Aug 31, 2009 at 1:44 PM, Donald Woods <dw...@apache.org> wrote:
> Are there any timeout, deadlock or resource contention errors on the DB
> side?
>
> Not that I can see any evidence of. Nothing in logs and db is not throwing
an error related to it. There are some queries that take several seconds to
read the main table which is related to the table failing but they aren't
especially tight. How might I go about inducing a condition that could cause
a problem (IOW, in what situation would a long read/deadlock cause this
error?)
Thanks.
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com
Re: SingleFieldManager.preFlushPC
Posted by Donald Woods <dw...@apache.org>.
Are there any timeout, deadlock or resource contention errors on the DB
side?
-Donald
Daryl Stultz wrote:
> On Fri, Aug 28, 2009 at 1:35 PM, Michael Dick <mi...@gmail.com>wrote:
>
>> Both Entities that have never been associated with an EM and those which
>> are
>> not currently associated with an EM are considered unmanaged.
>>
>> Put another way unmanaged == OpenJPA is not tracking the changes you make
>> to
>> the entity. So new entities and detached entities are unmanaged.
>>
>
> So if a detached entity is also unmanaged, why is it working 99.99% of the
> time (this exception has been thrown 3 times out of thousands of
> transactions). I don't have any Cascade settings on the properties that are
> failing and I'm always setting them to detached instances (the best that I
> can tell).
>
> (thoughts to be continued on your next reply.)
>
Re: SingleFieldManager.preFlushPC
Posted by Daryl Stultz <da...@6degrees.com>.
On Fri, Aug 28, 2009 at 1:35 PM, Michael Dick <mi...@gmail.com>wrote:
>
> Both Entities that have never been associated with an EM and those which
> are
> not currently associated with an EM are considered unmanaged.
>
> Put another way unmanaged == OpenJPA is not tracking the changes you make
> to
> the entity. So new entities and detached entities are unmanaged.
>
So if a detached entity is also unmanaged, why is it working 99.99% of the
time (this exception has been thrown 3 times out of thousands of
transactions). I don't have any Cascade settings on the properties that are
failing and I'm always setting them to detached instances (the best that I
can tell).
(thoughts to be continued on your next reply.)
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com
Re: SingleFieldManager.preFlushPC
Posted by Daryl Stultz <da...@6degrees.com>.
On Fri, Aug 28, 2009 at 3:37 PM, Michael Dick <mi...@gmail.com>wrote:
>
> Lets just look at your example for now though and I'll try not to muddy the
> waters any more.
>
I may be muddying the waters myself as this test case is not the source of
my woes, you just mentioned it doesn't look right. It is not the thing
that's causing the original exception.
> ScheduledAssignment saOne = setup.insertScheduledAssignment(...);
> >
>
> saOne is persisted and committed in a separate transaction?
>
Yes.
> > em.getTransaction().begin();
> > em.merge(entry);
> > em.getTransaction().commit(); // expected this to fail, but it works
> >
>
> Aha, you're calling em.merge which is slightly different than em.persist.
Since this isn't the case that causes the original complaint, it may be
misleading you. I happen to be calling merge here, but the failing case is
probably calling persist since the exception includes PERSIST rather than
MERGE. Out of interest, I changed merge to persist and it still works.
So I think we're a bit off track now, talking about 2 different scenarios.
Back to the original exception, I have a save() method that calls either
em.persist() or em.merge() depending on the ID of the object. I assume in
the case given, em.persist() was called given that PERSIST appears in the
exception. So I am persisting an object with a property set to an object
that exists in the database and is currently detached without any Cascade
setting. It works most of the time but has failed with the original
exception.
I'm not sure yet if I fully understand what an unmanaged object is. Can you
read back a couple posts and answer the outstanding questions?
Thanks for your help.
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com
Re: SingleFieldManager.preFlushPC
Posted by Michael Dick <mi...@gmail.com>.
Daryl Stultz wrote:
>
> On Fri, Aug 28, 2009 at 1:46 PM, Michael Dick
> <mi...@gmail.com>wrote:
>
>>
>> The scenario you've described doesn't sound right (maybe I need a
>> refresher). The new ShippingInstructions object should be unmanaged
>> unless
>> you've managed to inject a StateManager into it (which would be a good
>> trick).
>>
>
> No, I've never injected anything in my life. I'm working in Tomcat. I'm
> still confused, if an object has a state manager it's managed? Doesn't a
> detached object have a state manager? Here's my unit test (as clean as
> possible):
>
My fault, I shouldn't have mentioned injecting a StateManager - there's
almost no way you could have done that.
Detachted Entities do have a StateManager some of the time. You can
configure the detached SM to be transient in which case it'll be lost at
serialization time (you can also remove the detached SM entirely though).
Obligatory link to
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_detach_graph
docs
Lets just look at your example for now though and I'll try not to muddy the
waters any more.
Daryl Stultz wrote:
>
> User editingUser = em.find(User.class, userOneId);
> ScheduledAssignment saOne = setup.insertScheduledAssignment(...);
>
saOne is persisted and committed in a separate transaction?
Daryl Stultz wrote:
>
> TimeTrackingEntry entry = new TimeTrackingEntry();
> entry.setScheduledAssignment(saOne);
> entry.setStartTime(startTime);
> entry.setStartTime(endTime);
> em = setup.getEntityManager(); // different em than above, simulating
> different thread/web transaction
> User editingUserClone = new User();
> editingUserClone.setId(editingUser.getId());
> editingUserClone.setArchived(editingUser.isArchived());
> ... more property copying
> entry.setAddedBy(editingUserClone);
> entry.setAddedOn(Calendar.getInstance().getTime());
> em.getTransaction().begin();
> em.merge(entry);
> em.getTransaction().commit(); // expected this to fail, but it works
>
Aha, you're calling em.merge which is slightly different than em.persist.
Merge handles detached, or unmanaged entities differently. If a row in the
database matches the entity you're merging we'll issue an update (there's
some version checking here to help prevent the app from shooting itself in
the foot too).
The error message we gave you is a bit misleading in this case. We should be
using Cascade.MERGE instead of Cascade.PERSIST. This may be a case where we
find the row in the database and issue an update, if the row isn't found we
go back and do a 'normal' persist - resulting in the error message you see.
>From what you've said the row always exists in the database though - so
maybe this isn't a perfect match..
-mike
Daryl Stultz wrote:
>
>>
>> Out of idle curiosity do you have any properties set in persistence.xml?
>> Or
>> should I be able to reproduce this with OpenJPA's default configuration?
>>
>
> <property name="openjpa.LockManager" value="none" />
> <property name="openjpa.DetachState" value="loaded(AccessUnloaded=false)"
> />
>
> --
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:daryl@6degrees.com
>
>
--
View this message in context: http://n2.nabble.com/SingleFieldManager-preFlushPC-tp3534271p3536988.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.
Re: SingleFieldManager.preFlushPC
Posted by Daryl Stultz <da...@6degrees.com>.
On Fri, Aug 28, 2009 at 1:46 PM, Michael Dick <mi...@gmail.com>wrote:
>
> The scenario you've described doesn't sound right (maybe I need a
> refresher). The new ShippingInstructions object should be unmanaged unless
> you've managed to inject a StateManager into it (which would be a good
> trick).
>
No, I've never injected anything in my life. I'm working in Tomcat. I'm
still confused, if an object has a state manager it's managed? Doesn't a
detached object have a state manager? Here's my unit test (as clean as
possible):
User editingUser = em.find(User.class, userOneId);
ScheduledAssignment saOne = setup.insertScheduledAssignment(...);
TimeTrackingEntry entry = new TimeTrackingEntry();
entry.setScheduledAssignment(saOne);
entry.setStartTime(startTime);
entry.setStartTime(endTime);
em = setup.getEntityManager(); // different em than above, simulating
different thread/web transaction
User editingUserClone = new User();
editingUserClone.setId(editingUser.getId());
editingUserClone.setArchived(editingUser.isArchived());
... more property copying
entry.setAddedBy(editingUserClone);
entry.setAddedOn(Calendar.getInstance().getTime());
em.getTransaction().begin();
em.merge(entry);
em.getTransaction().commit(); // expected this to fail, but it works
>
> Out of idle curiosity do you have any properties set in persistence.xml? Or
> should I be able to reproduce this with OpenJPA's default configuration?
>
<property name="openjpa.LockManager" value="none" />
<property name="openjpa.DetachState" value="loaded(AccessUnloaded=false)" />
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com
Re: SingleFieldManager.preFlushPC
Posted by Michael Dick <mi...@gmail.com>.
<snip>
Michael Dick wrote:
>
> On Fri, Aug 28, 2009 at 11:40 AM, Daryl Stultz <da...@6degrees.com> wrote:
>
>> Thus far the exception has occurred on 2 different properties of my main
>> entity (ShippingInstructions and, I don't know, "ShippedBy"). In both
>> cases
>> ShippingInstructions and ShippedBy were entites already existing in the
>> database. This is indicated by the primary key that follows the
>> "FailedObject" (1981 above).
>>
>> As a test, I instantiated a ShippingInstructions and persisted it. I then
>> instantiated another ShippingInstructions and manually copied all the
>> properties (including the ID) from the persisted instance to the new
>> instance. I instantiated an Order and set the ShippingInstructions from
>> the
>> "clone". I persisted the Order and it worked fine. So the
>> cloned ShippingInstructions object was never associated with an em, but
>> the
>> persist was successful.
>>
>> I understand that I can't persist a new entity with a property that is
>> also
>> a new entity without Cascade.PERSIST, but that is not my case.
>
>
> So you do have Cascade.PERSIST set? Otherwise the scenario above should
> fail. I haven't gone back and reviewed the earlier threads, just ignore
> this
> part if it's already been covered.
>
>
After reading the preceding paragraphs again i think I understand what
you're saying, sorry for any confusion..
The scenario you've described doesn't sound right (maybe I need a
refresher). The new ShippingInstructions object should be unmanaged unless
you've managed to inject a StateManager into it (which would be a good
trick).
Out of idle curiosity do you have any properties set in persistence.xml? Or
should I be able to reproduce this with OpenJPA's default configuration?
-mike
--
View this message in context: http://n2.nabble.com/SingleFieldManager-preFlushPC-tp3534271p3536258.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.
Re: SingleFieldManager.preFlushPC
Posted by Michael Dick <mi...@gmail.com>.
On Fri, Aug 28, 2009 at 11:40 AM, Daryl Stultz <da...@6degrees.com> wrote:
> On Fri, Aug 28, 2009 at 12:25 PM, Kevin Sutter <kw...@gmail.com> wrote:
>
> > Hi Daryl,
> > An unmanaged object is one that has not been associated with a
> persistence
> > context (entity manager).
>
>
> Does this mean an object that has *never* been associated with an em, or
> one
> that is not *currently* associated? Are you referring only to "new"
> objects?
> Is a detached instance "unmanaged"?
>
Both Entities that have never been associated with an EM and those which are
not currently associated with an EM are considered unmanaged.
Put another way unmanaged == OpenJPA is not tracking the changes you make to
the entity. So new entities and detached entities are unmanaged.
> As indicated, there are several options
> > for getting around this situation. You could remember to call persist on
> > this new ShippingInstructions object, or you could set the properties to
> do
> > the cascade operation to the related fields.
> >
>
> Thus far the exception has occurred on 2 different properties of my main
> entity (ShippingInstructions and, I don't know, "ShippedBy"). In both cases
> ShippingInstructions and ShippedBy were entites already existing in the
> database. This is indicated by the primary key that follows the
> "FailedObject" (1981 above).
>
> As a test, I instantiated a ShippingInstructions and persisted it. I then
> instantiated another ShippingInstructions and manually copied all the
> properties (including the ID) from the persisted instance to the new
> instance. I instantiated an Order and set the ShippingInstructions from the
> "clone". I persisted the Order and it worked fine. So the
> cloned ShippingInstructions object was never associated with an em, but the
> persist was successful.
>
> I understand that I can't persist a new entity with a property that is also
> a new entity without Cascade.PERSIST, but that is not my case.
So you do have Cascade.PERSIST set? Otherwise the scenario above should
fail. I haven't gone back and reviewed the earlier threads, just ignore this
part if it's already been covered.
-mike
> --
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:daryl@6degrees.com
>
Re: SingleFieldManager.preFlushPC
Posted by Daryl Stultz <da...@6degrees.com>.
On Fri, Aug 28, 2009 at 12:25 PM, Kevin Sutter <kw...@gmail.com> wrote:
> Hi Daryl,
> An unmanaged object is one that has not been associated with a persistence
> context (entity manager).
Does this mean an object that has *never* been associated with an em, or one
that is not *currently* associated? Are you referring only to "new" objects?
Is a detached instance "unmanaged"?
> As indicated, there are several options
> for getting around this situation. You could remember to call persist on
> this new ShippingInstructions object, or you could set the properties to do
> the cascade operation to the related fields.
>
Thus far the exception has occurred on 2 different properties of my main
entity (ShippingInstructions and, I don't know, "ShippedBy"). In both cases
ShippingInstructions and ShippedBy were entites already existing in the
database. This is indicated by the primary key that follows the
"FailedObject" (1981 above).
As a test, I instantiated a ShippingInstructions and persisted it. I then
instantiated another ShippingInstructions and manually copied all the
properties (including the ID) from the persisted instance to the new
instance. I instantiated an Order and set the ShippingInstructions from the
"clone". I persisted the Order and it worked fine. So the
cloned ShippingInstructions object was never associated with an em, but the
persist was successful.
I understand that I can't persist a new entity with a property that is also
a new entity without Cascade.PERSIST, but that is not my case.
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com
Re: SingleFieldManager.preFlushPC
Posted by Kevin Sutter <kw...@gmail.com>.
Hi Daryl,
An unmanaged object is one that has not been associated with a persistence
context (entity manager). So, as an example, suppose you have two objects
with a one-to-one relationship (Order and ShippingInstructions). If you
create both objects, but then only call persist() on one of them, you could
experience the exception you posted below when attempting to flush the
information to the database. The exception text is indicating that an
unmanaged field (ie. ShippingInstructions) was detected when attempting to
flush the parent object (Order). As indicated, there are several options
for getting around this situation. You could remember to call persist on
this new ShippingInstructions object, or you could set the properties to do
the cascade operation to the related fields.
Does that help?
Kevin
On Fri, Aug 28, 2009 at 7:15 AM, Daryl Stultz <da...@6degrees.com> wrote:
> Hello,
>
> I've tried unsuccessfully to get help from the users' list. Hopefully
> someone here can shed some light.
>
> I'm getting this error:
>
> org.apache.openjpa.persistence.InvalidStateException: Encountered unmanaged
> object in persistent field "blah.model.MyEntity.anotherEntity" during
> flush.
> However, this field does not allow cascade persist. Set the cascade
> attribute for this field to CascadeType.PERSIST or CascadeType.ALL (JPA
> annotations) or "persist" or "all" (JPA orm.xml), or enable cascade-persist
> globally, or manually persist the related field value prior to flushing.
> You
> cannot flush unmanaged objects or graphs that have persistent associations
> to unmanaged objects.
> FailedObject: blah.model.AnotherEntity-1981
> at
>
> org.apache.openjpa.kernel.SingleFieldManager.preFlushPC(SingleFieldManager.java:754)
> at
>
> org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:594)
>
> SingleFieldManager.preFlushPC looks like this, with the last line throwing
> my exception:
>
> OpenJPAStateManager sm;
>
>
> *if* (vmd.getCascadePersist() == ValueMetaData.*CASCADE_NONE*) {
>
> *if* (!_broker.isDetachedNew() && _broker.isDetached(obj))
>
> *return*; // allow but ignore
>
>
> sm = _broker.getStateManager(obj);
>
> *if* (sm == *null* || !sm.isPersistent())
>
> *throw* *new* InvalidStateException(
>
> *_loc*.get("cant-cascade-persist", vmd))
>
> .setFailedObject(obj);
>
>
> I can't reproduce the problem, so I don't know if sm is null or sm is not
> persistent. I have 2 questions that are maybe the same: what condition
> leads
> to sm being null or not persistent and what exactly is an "unmanaged"
> object?
>
> Thanks.
>
> --
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:daryl@6degrees.com
>