Hi,

I have a question related to EJB  and Transactions. I wrote two  Entity
( Container Managed ) beans each  will create a row in two separate
tables of a same pool.Its necessary to create two rows at the same time
with different tables  otherwise it will become inconsistent.

For this requirement is it necessary to  use
javax.transaction.Transaction class ? it the servlet (  which calls two
EJBs ).

I wrote the servlet like this.

Context octx = getInitialContextForOrder();
Context pctx = getInitialContextForPayment();
 // Using userTransaction
     transaction =
(UserTransaction)octx.lookup("javax.transaction.UserTransaction");
     transaction.begin();
           StoreOrderHome ohome = (StoreOrderHome)
octx.lookup("storeorder");
           StoreOrder oremote = (StoreOrder)
ohome.create(orderno,ammount,paid);
           PaymentHome phome   =
(PaymentHome)pctx.lookup("storepaymentinfo");
           Payment     premote = (Payment)
phome.create(customerid,ammount,orderno,paid);
    transaction.commit();

without  using Transacton .begin() and commit() also no difference.

Is this right way to use Transaction class ? how to use rollback() and
remaining methods with the EJB's itself.

waiting for ur help.
Regds...Jayadev Gali

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