Hi,

with latest stable OpenJPA i have a problem which might be there because of 
misunderstanding on my side.

For instance take these PC class:

Class A {
public int oid;
public String name;
public B classB;
}

Class B {
public int oid;
public String name;
}


Now my appCode:
--------------------------

A classA = new A();
a.setName("foo");

B classB = someDao.findClassB();
classA.setB(classB); // classB is detached for this example

em.persist(classA);


=====

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. 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. Consequently i still cant 
persist "A". 

So my overall problem is that i cant persist a new Entity when this new entity 
has a detached object inside the graph because i cant bring the detached object 
back into the current context.

Thanks for hints.




---
regards
Marc



Reply via email to