Jboss version used is 4.0.5 GA with ejb3 deployer, 'all' configuration. The
import statement are like in the code below.
| import org.jboss.annotation.ejb.TransactionTimeout;
| import javax.ejb.*;
|
| @PersistenceContext
| EntityManager em;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
| @TransactionTimeout(3600)
| public Long doLongTransaction(List<BaseEntity> entities)
| {
| for(BaseEntity entity : entities)
| {
| if (condition)
| persistEntity(entity);
| else
| updateEntity(entity);
| }
| }
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void persistEntity(BaseEntity entity)
| {
| em.persist(entity);
| }
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void updateEntity(BaseEntity entity)
| {
| em.merge(entity);
| }
|
Thanks,
Mihai
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4244826#4244826
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4244826
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user