Hello,
I have a question about the EntityManager#persist() method. I’m learning JPA so I already apologize if my question is trivial for you ;-)
Let’s say I have 2 Classes : One Service Façade that defines the transaction boundary and a DAO.
The first Service Façade has a business method with @TransactionAttribute(TransactionAttributeType.REQUIRED_NEW). This method calls second a method that belongs to a DAO with @TransactionAttribute(TransactionAttributeType.REQUIRED) attribute.
The transaction of the DAO is merged with the Service Facade transaction. Fine. This second method injects an EntityManager, creates an Entity that calls em.persist(entity). At the end of this second method, the EntityManager is closed and entity is detached.
My question is: is this new detached entity (the caller could even have no reference of it in fact) will be committed when the Service Façade transaction will commit (at the end of its business method) ? Or do I have to explicitly merge this entity in my Service Façade in order that entity is committed with the Service Facade end of transaction ?
It would mean that the method where I do persist an entity is a transaction boundary, if not I must merge this detached entity in a caller method that is the transaction boundary.
Help would be *very* appreciated !
Thanks !
Jean-Paul DZISIAK
[Message sent by forum member 'jep' ]
http://forums.java.net/jive/thread.jspa?messageID=373739