Hi Reddy,
 I would like to give u more information about the problem so that it will be easier 
for u to understand it exactly. i m using entity bean  which has container managed 
transcation. This ejb has one helper class(DAO) for database transactions . ejb calls 
DAO's create method in its ejbcreate method. now DAO's create method calls one more 
method named insertIndividual() which actually updates the D/B ie it executes 3 insert 
queries. Now if SQL exception occures in this method, it throws it to create of DAO 
and then to ejbcreate of ejb which will throw the EJBexception  causing rollback . but 
it is not doing this way. Actually it says transaction rolled back. but doesn't undo 
changes in D/B.
what must be happening?
I will appreciate ur reply.
thanks




On Fri, 19 January 2001, E Bakka Reddy wrote:

>
> Hi Pooja,
>
> I understood u problem, no need of doing anything like catching
> SQLException.
>
> What ever i gave in my last mail it works fine.
>
>
> <%@ page import="javax.transaction.*" %>
>
> UserTransaction u = (UserTransaction) ctx.lookup(
> "javax.transaction.UserTransaction");
>   u.begin();
>   deposit=depositHome.create(accountId,balance);
>   System.out.println("Record Created in deposit");
>   accountId="5";
>   withdraw=withdrawHome.create(accountId,balance);
>   System.out.println("Record Created in withdraw");
>   u.commit();
>
> in the above code i am inserting two records into a table from two beans,
> if second bean fails to create, the entire transaction will be rolled back.
>
>
>
>  otherewise u can use executeBatch
>
> And executebatch.
>
> Statement smt = con.createStatement();
> stmt.addBatch("INSERT INTO COFFEES" +
>               "VALUES('Amaretto', 49, 9.99, 0, 0)");
> stmt.addBatch("INSERT INTO COFFEES" +
>               "VALUES('Hazelnut', 49, 9.99, 0, 0)");
> stmt.addBatch("INSERT INTO COFFEES" +
>               "VALUES('Amaretto_decaf', 49, 10.99, 0, 0)");
> stmt.addBatch("INSERT INTO COFFEES" +
>               "VALUES('Hazelnut_decaf', 49, 10.99, 0, 0)");
>
> stmt.executeBatch(); I hope here also any one of insert stmt fails the
> transaction will rolled back.
>
>
> Edla B. Reddy
>
> ===========================================================================
> 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".


Chequemail.com - a free web based e-mail service that also pays!!!
http://www.chequemail.com

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