• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Method SetRollbackOnly don't work!

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
It wasn't my idea to go to some crazy nightclub in the middle of nowhere. I just wanted to stay home and cuddle with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic