How JPA Transactions Work ? DAOs and Transactions generic is possible ?
Hi all,
I have a question respect to a EJB3.0 JPA Transactions work.
if i have the folowing code inside EJB container:
In a Generic DAO:
public Object mergeEntity(Object entity) {
return em.merge(entity);
}
public Object persistEntity(Object entity) {
em.persist(entity);
return entity;
}
In a Facade:
public void execute(){
obj.persistEntity(entity);
obj.mergeEntity(entity);
}
When transaction is committed ?
When execute method finish ?
Another question for transactions is.
If a have a factory of DAOs one for EJBs and other for DAOs implemented with JDBC hard code.
What implement a generic layer for manager transactions transparently for my Facades ?
if assumes, i manager transactions manually what abstract this layer to my facade use a comon treatment for transactions ?
It's necessary for my application a common ana trasparent DAOs and transaction use for client layer.
Thanks.

