Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Method SetRollbackOnly don't work!  RSS feed

 
Sam Wang
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!