[jboss-user] [EJB 3.0] - Re: Can't get @TransactionTimeout to work
mihai.ratiu
do-not-reply at jboss.com
Tue Jul 21 03:26:24 EDT 2009
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
More information about the jboss-user
mailing list