Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

BMP stateless session bean can't roll back using JTA  RSS feed

 
yunfat chou
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use weblogic6.1sp2 + jdk131
A stateless session bean must do 2 things:
insert a record to A table and delete another record in A table
This bean has the same structure as the example in j2eetutorial/examples/src/ejb/teller
I use TxDataSource in weblogic
If delete fail, the roll back is run,but in database,
the insert record is STILL in A table.
More:
I close the connection autocommit,but find no records can be inserted into the table,why?
Code For begin,commit and rollback
UserTransaction ut = null;
try{
ut = sessionContext.getUserTransaction();
ut.begin();
//test code
ut.commit();
}catch(Exception e){
try {
ut.rollback();
}
catch (SystemException se) {
}
}
Code for connection:
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup(dbName);
con = ds.getConnection();
con.setAutoCommit(false);
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!