-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HyperSQL verses PostgreSQL Exception Handling
PostPosted: Wed Jan 16, 2013 1:48 pm 
Newbie

Joined: Mon Jan 14, 2013 4:07 pm
Posts: 17
I was wondering if anyone could explain why validation exceptions are thrown differently with exactly the same code but with different drivers. When using HSQL a ConstraintViolationException is called from preInsert directly during a call to #persist. With PSQL the exception is not thrown from #persist but from preInsert during a #commit call. Furthermore, for HSQL the ConstraintViolationException is thrown raw from #persist while for PSQL it is wrapped in a RollbackException which is then wrapped in a TransactionSystemException.

Because of this, code I have written for HSQL has to be rewritten for PSQL. I could understand having to do this for database specific features but for Bean Validation, well I guess I'm not sure why the validate call happens in two different places. Also, are there good patterns for crafting Hibernate/JPA exception handling so that it can work with both drivers without looking redundant and ugly?

TIA


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.