This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm using EJB 1.0 and need to know how to catch a DuplicateKeyException in my CMP EJB. My create method only throws CreateException (superclass of DuplicateKeyException) and when I attempt to use the bean to write a record with a duplicate PK, an SQLException is thrown, but by the time the exception reaches my session bean it's turned into this exception: "CORBA TRANSACTION_ROLLEDBACK 0 No; nested exception is: org.omg.CORBA.TRANSACTION_ROLLEDBACK:". I can see the duplicate error in the stacktrace: it's nested deep within the above one - but I want to show the user the correct error. Is there a way to do this? You could argue that I should try and see if the record is already there, but that seems like a bit of an overhead. TIA for any help. Dave