I should have noticed this before. The
System.out.println("IS AUTOCOMMIT: " + (conn.getAutoCommit()));
prints false which means that AutoCommit has already been disabled. So its not
the problem with autocommit. A little bit of reading the MySQL documents made
me realize that unless your tables use "InnoDB" engine, transactions are not
going to work. So i changed my table definition to use InnoDB engine instead of
MyISAM engine (which is what i was using earlier). So your table definition
should look like:
anonymous wrote : CREATE TABLE `testtx` (
| `Name` varchar(255) default NULL
| ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
Changing the table definition and running the code worked perfectly with the
insert getting rolled back when a RuntimeException is thrown. Give it a try.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120890#4120890
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120890
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user