• 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

Handling database exception in CMP

 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have a stateless session bean acting as a facade for CMP entity bean. Our container is WebLogic 8.1 and our database is Oracle 9i. What happens is a remote client calls a method on the session bean, which starts a transaction. This method then calls a set method on the CMP using the same transaction. However, there is a unique constraint on this field in Oracle, so occasionally Oracle can object to the value that was set. This is formed into a SQLException, but it's not thrown by the CMP's setter, since it doesn't actually occur until the container stores the new value. In fact, it can't be caught by the session bean at all. When the transaction tries to commit, WebLogic wraps the SQLException in a Runtime "unexpected" exception and throws it back to the original client.

My question: is there any way we can catch this in the session bean so we can report the error more clearly back to the client? Thanks!
 
This tiny ad will self destruct in five seconds.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic