Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Handling database exception in CMP

Posts: 3036
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
  • 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!
Never trust an airline that limits their passengers to one carry on iguana. Put this tiny ad in your shoe:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic