[jboss-user] [EJB 3.0] - Re: Can't get @TransactionTimeout to work
mihai.ratiu
do-not-reply at jboss.com
Mon Jul 20 10:11:45 EDT 2009
My objective is to set a different timeout (greater than default of 5 mins) for a method that need to process a group of objects in a long transaction. So I tried to use the @TransactionTimeout annotation. Below is a simplified pseudocode with what I want to do.
| @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);
| }
|
If I try to set a minimum timeout to see if the transaction for this method will timeout let's say, after a minute it doesn't work, it will only timeout after the default 5 minutes value.
Am I missing something. Is there any other possibility to set a different transaction timeout for a method without affecting the global transaction default timeout?
Thanks,
Mihai
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4244656#4244656
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4244656
More information about the jboss-user
mailing list