[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Calling datasource.getConnection() after sessionContext.
jaikiran
do-not-reply at jboss.com
Sat Aug 2 04:13:07 EDT 2008
As Peter said, its better to try it against 4.2.x first.
Also,
| if (somethingGoesWrong()) {
| sessionContext.setRollbackOnly();
|
| //Then get connection to the DB
| javax.sql.DataSource dataSource = ....;
| java.sql.Connection con = dataSource.getConnection();
|
| //and execute a query
| ...
| }
How about re-ordering the statements? The sessionContext.setRollbackOnly() is going to mark the transaction for rollback. So why not get the datasource connection and run the query first (probably through a @RequiresNew transaction method) and then setRollbackOnly on the sessionContext.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4168282#4168282
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4168282
More information about the jboss-user
mailing list