On Tue, Dec 15, 2009 at 8:22 AM, Marc Logemann <[email protected]> wrote:
> When i do this, i am getting the exception that i cant persist a detached > class (classB). This is okay and i am aware of that. Hmm, I think I do this sort of thing all the time. What CascadeType are you using on a.classB? Now i tried to attach "B" to the context before persisting via: > > em.merge(classB); > > Really interessting is that after the merge, the call to > OpenJPAEntityManager.isDetached() still returns TRUE. em.merge(classB) does not modify classB but returns a merged copy of classB. So you would need to do this: classA.setB(em.merge(classB)); I'm using 1.2.1 and I'm not an expert so I don't want to steer you wrong, as I said I'm pretty sure I can persist an entity with a relation to a detached entity, but there may be more details to both our situations. -- Daryl Stultz _____________________________________ 6 Degrees Software and Consulting, Inc. http://www.6degrees.com mailto:[email protected]
