• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

BMP stateless session bean can't roll back using JTA

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
 
reply
    Bookmark Topic Watch Topic
  • New Topic