I had a similar concern with Trails, and made my own persistence service that uses Hibernate directly. With Hibernate 3.1 you don't really need the Spring ORM stuff.
"Xiaoshu Wang" <[EMAIL PROTECTED]> skrev i en meddelelse news:[EMAIL PROTECTED] > Thanks, James. > > I am able to get the exception now. However, the exceptions seem to be > wrapped into spring's DataAccessException. The original cause of > HibernateException is gone. I tried to traverse the Exception track by > getCause(), but only get the DataIntegrityViolationException and > java.sql.BatchUpdateException. > > I am writing an application that has two fields that can violate the same > contraints. The lost of HibernateException won't allow me to figure out > the > which field is duplicated. > > Xiaoshu > >> -----Original Message----- >> From: James Carman [mailto:[EMAIL PROTECTED] >> Sent: Wednesday, August 16, 2006 6:05 AM >> To: 'Tapestry users' >> Subject: RE: tapernate question >> >> If you want more fine-grained control over what's going on, >> turn off transaction-per-request and use service methods with >> transaction interceptors on them to achieve what you want. >> The reason that you didn't get the exception is that the >> transaction isn't committing until the end of the request and >> that's when you'll get the unique constraint violation >> exception. The exception presenter might not even catch >> this, come to think of it. I actually changed the way >> Tapernate is implemented in my local copy. I might need to >> push that out to the rest of you. >> >> -----Original Message----- >> From: Xiaoshu Wang [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, August 15, 2006 9:45 PM >> To: 'Tapestry users' >> Subject: RE: tapernate question >> >> I tried to put something like >> >> try { >> getSession.update(message); >> } catch (Throwable e) { >> System.out.println("Catch it."); >> } >> >> under the MessageDaoImpl.update(Message), but it seems not >> doing anything. >> >> How to hook with ExceptionPresenter? >> >> Xiaoshu >> >> >> > -----Original Message----- >> > From: James Carman [mailto:[EMAIL PROTECTED] >> > Sent: Tuesday, August 15, 2006 9:09 PM >> > To: 'Tapestry users' >> > Subject: RE: tapernate question >> > >> > You can put in a hook into the ExceptionPresenter or wrap your call >> > with a try/catch block. The HibernateService class can be found at: >> > >> > http://svn.javaforge.com/svn/hivemind/hivemind-utils/trunk/src >> /main/java/com >> > /javaforge/hivemind/util/HiveMindService.java >> > >> > The username/password is anonymous/anon. >> > >> > >> > -----Original Message----- >> > From: Xiaoshu Wang [mailto:[EMAIL PROTECTED] >> > Sent: Tuesday, August 15, 2006 9:03 PM >> > To: [email protected] >> > Subject: tapernate question >> > >> > Hi, I am playing around Tapernate, which I have a question >> to ask. It >> > seems that the exception thrown by a database query would >> not be able >> > to be catched at the application level. >> > For isnstance, I justed added a unique constraints on the >> > Message.value property. If I ever try to created a message >> that has a >> > duplicated value with an existing Message, it break the >> application. >> > I didn't find a way to catch the exception. Is this >> expected behavior >> > or not? >> > >> > Also, where I can find the source code for the HibernateService? >> > >> > Thanks, >> > >> > XW >> > >> > >> > >> --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> > >> --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
