Hello all!
I'm new here and I have a question.
I'm using a H2 database on a JTA XA infrastructure made up of Spring
and JBoss Transactions.
I have a problem whenever I try to start a second transaction in the
same thread, with a propagation behaviour of REQUIRES_NEW.

Suppose I have the following (all executed in a single thread):

1) create transaction t1
2) insert a row in a table in t1 context
3) create transaction t2 with propagation behaviour of REQUIRES_NEW
4) insert another row in the same table in t2 context

When step 3 is executed, t1 transaction is temporarily suspended, a
new t2 transaction is created and, when t2 will end, t1 will be
resumed. This is all managed by Spring+JBoss Transactions.

When step 4 is executed, however, I get the following exception:
org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "MYTABLE";
SQL statement:
SELECT MAX(Id) AS MyMax FROM MyTable [50200-139]

The isolation level is READ_COMMITTED for both t1 and t2.
I would have expected this scenario to work, but it seems like the
first transaction t1, which should be suspended, is holding a lock on
the table and this lock is preventing step 4 to be executed in the
context of another transaction.
The same thing also happens if step 2) and 4) write on different
tables.

Any suggestion will be appreciated.
Thanks in advance,
Mauro Molinari

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to