I have one CMP named, EmpTest having composite PK as, empId & empSurname.
I have finderHelper on field called, empName.
From my stateful session bean, TxnSupport, having Txn attribute, TX_BEAN_MANAGED & isolation level as, TRANSACTION_REPEATABLE_READ.
In this bean, from session context i am deriving UserTransaction. So I am having corresponding,
on error userTrans.rollback();
There is a loop between begin & commit.
#CODE BLOCK - is
First time, I make findByName, I dont get the record, so I create new one. In the same transaction, next time, I execute same findByName, still I dont get the record. (This surprises me !)
But then at the time of creation of record, it says Duplicate Key Exception, & transaction rolled back.
So Qn is in the first pass record is not found, so it creates a new one, then in the second time why it doesnt get that record ? Though then record is not there, then why it doent let it to be added ? Why it gives Duplicate record exception ?
My environment is :
IBM VAJ 3.5
IBM DB2 6.0
Can anyone throw light on this ?