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.
|