views:

44

answers:

1

I am using JBoss Seam and working with transactions. I have 2 methods with the @Transactional annotation.

@Transactional
public void method1()
{
   ...
   entityManager.flush();
}

@Transactional
public void method2()
{
   ...
   entityManager.flush();
}

My problem is that if method1 and method2 are being executed at the same time and method1 ends the transaction, then there will not be any running transactions for method2. How can I solve this? Can I force a transaction to be always active while there is code running on the method, even using manual flushing?

A: 

That's a little bit late to answer... but it should do... :)

I just removed all the manual flushes from the code and let Seam take care of the transactions... and it workes as I wished.

Diego Dias