Hi there
I'm a bit confused with the transactions in the
EJB context...
To sort things out, i've tried a simple example but, to me, it doesn't work the way it should :
A StatelessSessionEJBBean insert 2 rows in my database.
Each insert is a simple "Insert into.." with a primary key.
The connection.AutoCommit is set to "false" not to disturb the EJB container. The deployement descriptor says that my EJB's <trans-attribute> is "Required".
First time i run my EJB, every thing is ok : 2 rows are created and the commit is well performed.
Before I run the EJB a second time, I remove one of the previously inserted row using SQL*PLUS, then I commit.
Next, I run the EJB a second time (using the same values as the first time)
Of course, an exception is thrown (unique constraint violated for one of the row)
So, what do i have in my database : 2 rows. The one inserted at the first execution and the other one inserted at the the second execution, just before the exception occurs.
In my mind, the exception in the second run should rollback the whole transaction, so no row should be commited this time...
I'm wrong or what ?
If someone can clarify the situation...
Thanx in advance
[ October 15, 2003: Message edited by: Franck Tranchant ]