"Wolfgang Knauf" wrote : Hi, | | Here is something from chapter 5.6.1, but this does not make it much clearer: | anonymous wrote : A new persistence context begins when the container-managed entity manager is invoked in the scope of an active JTA transaction, and there is no current persistence context already associated with | | the JTA transaction. The persistence context is created and then associated with the JTA transaction. | | | | The persistence context ends when the associated JTA transaction commits or rolls back, and all entities that were managed by the EntityManager become detached. | | | | If the entity manager is invoked outside the scope of a transaction, any entities loaded from the database will immediately become detached at the end of the method call. |
Thank you for your quick reply. But I don't understand what's going wrong. When doSomething of Bean2 is called from an other tier, a new transaction should be created. When in doSomething the method findEntity of Bean1 is called the same transaction should be used and no new one should be generated, because the default transaction type is REQUIRED. So I think that the persistence context should be bound to this transaction and the returned entity should not get detached, but it's not like this. Any ideas why this happens? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4190798#4190798 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4190798 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user