I suspect an issue with EntityManager propagation under OpenJPA 1.1.0.
I've been using OpenEJB3.0 (which includes OpenJPA 1.0.1), and recently
started kicking the tires on 3.1 (which includes OpenJPA 1.1.0)
I have re-created a pretty simple setup to highlight my problem:
A) Parent entity with LAZY OneToMany List<Child>, cascade:
PERSIST,MERGE,REFRESH
B) Child entity with EAGER ManyToOne Parent, cascade: PERSIST,MERGE,REFRESH
C)Abstract CRUD class with injected Extended PersistenceContext, and
requisite CRUD methods
D) Parent Stateful bean that extends CRUD
E) Child Stateful bean that extends CRUD
Classes are enhanced in place via ant prior to junit test run.
Under 1.1.0, when I attempt:
Parent p = parentBean.insert(new Parent("Foo"));
Child c = childBean.insert(new Child("Bar", p));
I receive the following Exception:
WARN
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(Ln
516) - Unexpected exception from beforeCompletion; transaction will roll
back
<openjpa-1.1.0-r422266:659716 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: The given instance
"entity.Parent-6264" is not managed by this context.
FailedObject: entity.Parent-6264
With 1.0.1, both entities were always reported as managed by both beans
regardless of the bean responsible for the load/persist/merge.
However, with 1.1.0, only the bean responsible for the load/persist/merge is
showing the entities as managed.
The attached http://n2.nabble.com/file/n1495977/example.jar example.jar
includes source in case someone is curious enough.... I use Postgres, but
the entity package contains a schema.sql that you should be able to
translate easily enough.
Thanks in Advance
--
View this message in context:
http://n2.nabble.com/EntityManager-Propagation-with-Extended-PersistenceContext-tp1495977p1495977.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.