Hi,

I am developing some stateless session beans, in which the beans' methods
are performing some database operations (insert, update directly and also
through stored procedures).
Beans are declared CMT and all methods in all the beans have attribute
*Required*. So, all the transactions are being handled by container.

In one of the bean, one of the method is getting a collection of Object
type, say ABC, getting iterator on it, and then using the while loop on this
iterator saving (inserting) all the objects in database.
In some cases (for testing purpose) the collection comes with two or more
records with same primary key. In this case, an SQL exception should be
thrown and the transaction should be rolled back.
Here's what's happening actually: SQL Exception is thrown, but rollback(ing)
is not being done. what ever records were inserted before this exception
occurred (in the while loop) get committed.

What may be the problem in the above case? As SQL exception is not an
application exception (or is it not considered a system exception?),
container should have set Rollback true. Do I need to use setRollbackOnly in
case of non-Application exceptions and errors also?

The same is happening in case of calling stored procedures also. Even if an
SQL exception comes after returning from stored procedure, what ever is done
in the stored procedure gets committed.

Env:
Weblogic v6.0 with sp2
OS: Win 2K
DB: MSSQL server 2000
I'm using Transactional Data Source, with two phase commit.

Any insight comments to this problem would be greatly appreciated.

Thanks,
- Hement

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