HI
The whole point of having an EJB server is to help you manage issues like transactions 
, scalability etc.
If your ejb uses bean managed transaction only then you will be able to get a handle 
to the trasaction service and do your
own commit and rollback. Otherwise every thing as they call it "DECLARATIVE TXN MGMT" 
....you just declare what your ejb
method's txn's props are and get it done thro the EJB server
arava

Harvey Chen wrote:

> 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".

===========================================================================
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