[EJB 3.0 Users] - Question regarding PersistenceContext propagation
by rmz
Hi everyone,
I have a secenario similar to the following. There are different persistent entity classes, "a", "b" and "c". Entity a contains one ore more of b, and b contains one or more of c.
Also, there are three different stateful session beans that wrap the three entities for client access, e.g., entity a is wrapped by stateful Bean A,
b is wrapped by stateful bean B and correspondingly for c and C.
Now when a client asks for entity a it gets access via a bean interface to A. When persisting or loading the entity structure this works via A (with
the PersistenceContext of A).
In all bean classes A, B, C I'm using Extended Persistent Contexts which I assume are propagated (from A --> B --> C) to the child beans when the
parent beans instantiate the childs.
However, it seems that the Persistence Context is not properly propagated by the container although the EntityManager's are the same for all beans
A, B, C. This means, entities that are attached to the Entity Manager in bean A are no longer attached to the same Entity Manager when called in bean B. To my understanding this can only happen when the persistece context is not properly propagated.
Can somebody provide an advice about how to ensure that the persistence context is propagated? I looked through a number of resources including "Hibernate in Action" but did not find something useful. Maybe I'm missing some annotation. Unfortunately I cannot easily construct a simple example because the entire thing is embedded in a larger project.
Thanks in advance for your comments,
-Rainer
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258188#4258188
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258188
15 years, 3 months