In one session bean,I call two cmp entity beans to insert records.
My code like below:
void addRecord(XXXInfo aInfo){
try{
XXXEntity aEntity = xxxEntityHome.create(XXXInfo aInfo);
//other entity set&get methods
}catch(Exception e){
context.setRollBackOnly();
//error handle
}
if(aInfo instanceof XXXYYYInfo){
try{
XXXYYYEntity bEntity = xxxyyyEntityHome.create((XXXYYYInfo)aInfo);
//other entity set&get methods
}catch(Exception e){
context.setRollBackOnly();
//error handle
}
}
}
When some client(
servlet or other
ejb) calls this method,a exception is been thrown at xxxyyyEntityHome.create.I look at database
a record of XXXEntity exists,none record of XXXYYYEntity exists.Transcation of
this method is 'required';
Then I say this setRollBackOnly doesn't work!
Is it true and what's wrong with my code?
[ April 23, 2002: Message edited by: Michael Wang ]