Hi, 

In some parts of my code I need to handle the transactions manually.

Dont pay too much attention to the actual example, just want to show the flow.

This is an example:


  | InitialContext ctx = new InitialContext();
  | DataSource ds = (DataSource)ctx.lookup("java:qpDS");                    
  | Connection conn = ds.getConnection();
  | Savepoint sp = conn.setSavepoint();
  | Statement stmnt = conn.createStatement();
  | stmnt.execute("insert into someTable (id, name) values(99, 'Text..')");
  | // Do something critacal that might fail here...
  | if(failed) {
  |     conn.rollback(sp);
  | }
  | stmnt.close();
  | conn.close();
  | 

Ofcourse this will fail if my connections autocommit property is true - which  
will be the case when using a local-tx-datasource.

I know I can use no-tx-datasource to get it work, but other parts of the 
application requires local-tx-datasource.

What do you suggest? Should I use two diffrent datasources? one 
local-tx-datasource and one no-tx-datasource?

Doesn't  sound like a good solution to me though.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3922230#3922230

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3922230


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to