-->
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.  [ 2 posts ] 
Author Message
 Post subject: Disabling Hibernate Validation on save/update with Hibernate
PostPosted: Tue Dec 07, 2010 3:37 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
I just started upgrading an application that used Hibernate 3.5.6.Final to 3.6.0.Final, and there has been several hickups. The last hickup I can't find a solution for.

3.6.0.Final seems to automatically turn on bean validation when an object is saved/updated through Hibernate. This is very bad because some of my tests don't bother setting all the properties - they just aren't needed. I honestly don't see the point to set every 'description' field and countless other fields just to comply with some arbitrary validation.

This is going to force me to spend hours making valid objects in all of my tests (I have over 1300 functional tests now). And frankly, it would be pointless because I am certain that all validation is happening in the MVC and there are no other ways to get data into the database currently.

I also don't want to incur a performance hit by validating my beans twice - once in the MVC, and then another time within Hibernate. It's just not needed in my case.

Is there a way I can turn this off? I am using Spring and regular Hibernate mapping files, not JPA (I dislike all the annotations).


Top
 Profile  
 
 Post subject: Re: Disabling Hibernate Validation on save/update with Hibernate
PostPosted: Tue Dec 07, 2010 3:54 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
I figured it out:

<prop key="javax.persistence.validation.mode">none</prop>

Added that to hibernateProperties in spring application context and works great.


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.