• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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 ]
 
All that thinking. Doesn't it hurt? What do you think about this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic