]
Charles O'Farrell commented on JBAS-7195:
-----------------------------------------
Without adding anything useful, I'm also wondering what the status is with this issue?
I'm curious what the JCA spec says about marking transaction roll-back and then
performing more DB operations. Previously using WebSphere we have had no problems with
doing this.
I'm currently using JBoss 5.1.0. Any comments on the subject would be greatly
appreciated.
On executing readonly query, WrappedConnection.checkTransactionStatus
throws exception when transaction is marked for roll back
-------------------------------------------------------------------------------------------------------------------------------
Key: JBAS-7195
URL:
https://jira.jboss.org/jira/browse/JBAS-7195
Project: JBoss Application Server
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: JCA service
Affects Versions: JBossAS-4.2.3.GA, JBossAS-5.0.0.CR2, JBossAS-5.0.0.GA,
JBossAS-5.0.1.GA, JBossAS-5.1.0.Beta1, JBossAS-5.1.0.CR1, JBossAS-5.1.0.GA
Environment: linux/windows, jboss 4.2.3 onwards, jdk 1.5/1.6
Reporter: jay xxx
Assignee: Jesper Pedersen
Hi,
When using jboss 4.2.3 with our app, we got an error of this sort (not exact):
Cannot Execute query.....Transaction status marked rollback
Caused by: jboss.util.NestedSQLException
at ...WrappedConnection.checkTransactionStatus
Scenario when the above error happens:
a) User submits request from a web page
b) A jta transaction is started in a filter
c) From UI layer, transaction is propagated to service layer with "Propation
Required" setting.
d) Service layer throws an exception (validation) and transaction is marked for rollback.
Note that it is marked for rollback and not rolledback
e) The ui layer now prepares the view which requires some db queries to be executed. As
soon as the first query is tried to be executed, the above exception is thrown.
I tried the above same steps with jboss 4.2.1 and it works fine. On further probing,
found that in jboss 4.2.3, there was a change made as part of:
https://jira.jboss.org/jira/browse/JBAS-5080
https://jira.jboss.org/jira/browse/JBAS-5083
From jira links above, intention seems to be to prevent update sqls from getting
exectuted when transaction is marked for rollback. But looks like the code that was added
does not discriminate between read-only and update sqls and prevents even a prepared
statement from getting created - WrappedConnection.checkTransactionStatus throws an
exception "cannot execute query" transaction marked for rollback.
I believe that jca should discriminate between read only and update queries and should
*allow* read only queries to go through when transaction is marked for rollback. These
would allow the views to get generated in the same transaction. Ours is a 2-tier system
(ui + service layer execute in the same jvm) and we are using Hibernate's recommended
OpenSessionInViewPattern with one hib session+ one transaction per request.
Anyone has any thoughts about this? Is it a legitimate concern? Else, the options before
us are:
a) refactor our code to have one hib session + 2 transactions (one for service layer and
the other for the view). I believe even Jboss Seam does this.
b) We have a roadmap to migrate to jboss 4.2.3 followed by jboss 5.1 within next 4
months. Then we'll have to ourselves change the Wrapped connection code to
discriminate between read only and update queries.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: