Hi, Friends

If I use JTS and JTA only, how can EJB containter "commit" or "rollback" what I have 
done?

for example:

  ...
  UserTransaction ut = context.getUserTransaction();
  try{
   String ls_sql = "insert into TEST_USER (USER_ID,USER_NAME,DEPARTMENT ) values 
('"+ls_id+"','test1','test1 Dpt')";
   String ls_sql2 = "insert into TEST_USER (USER_ID,USER_NAME,DEPARTMENT ) values 
('"+ls_id2+"','test1','test1 Dpt')";

   makeConnection();
   st = conn.createStatement();
   ut.begin();
         st.executeUpdate(ls_sql);
         st.executeUpdate(ls_sql2);
   ut.commit();

   releaseConnection();
  }
  catch (Exception e){
   try{
    ut.rollback();
    releaseConnection();
   }
   catch (Exception ex){
    throw new EJBException ("rollback fail");
   }
  ...

if the first "insert" statement succeed but the second  "insert" statement fail, the 
program will run "ut.rollback();",
but will the first "insert" rollback too?

I tried many times, but I cann't "rollback" the first "insert" statement.

would anyone throw me a light?
thanks a lot!

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to