On Fri, Aug 28, 2009 at 12:25 PM, Kevin Sutter <[email protected]> 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:[email protected]
