-->
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: Validation constraint and preInsertListener
PostPosted: Mon Mar 06, 2017 11:26 am 
Newbie

Joined: Mon Mar 06, 2017 11:06 am
Posts: 1
I am wokring in a project that use hibernate 4.1.7.FINAL and I am using an implementation of preInsertEventListener to override the preInsert Method and javax.persistence.Column for validation (nullable=false ) every things gone right in 4.1.7.FINAL.

But when i upgrade the hibernate version to 5.2.8.FINAL the project throw an exception of null proprety because i am setting the proprety in the preInsert Method so as i see the hibernate lifecycle change to check the constraint validation before preInsert Method. I guess .

And when I added the hibernate validator dependecy every thing gone ok, and no thrown exception, without writting any line of code,I really want to know what happend exactly and if the constraint validation before the preInsert method why documentation doesn't say that (The domcumentation say the opposite of that : Whenever a PreInsertEvent, PreUpdateEvent or PreDeleteEvent occurs, the listener will verify all constraints of the entity instance and throw an exception).

Why the validation check lifecycle change from hibernate 4 to hibernate 5 it was before preInsert and now after preInsert ?

To Resume without the validator dependecy the constraint check validation is before the preInsert method and after adding the validator dependecy the constraint check validation is after the preInsert method get excuted how that works ?

THANKS.


Last edited by DMK-DEV on Mon Mar 06, 2017 2:08 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Validation constraint and preInsertListener
PostPosted: Mon Mar 06, 2017 1:26 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Can you rephrase your question because it's hard to follow what you are asking. Try to split it on multiple paragraphs, add some code examples, and refernce to the docs which you think they are stale.


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