Hibernate version: 3.2.4sp1
I don't know if I should post this in the core forum or the annotations forum... but it seems more related to the core of Hibernate.
I'm using a
PreInsertEventListener to set the value of a field with an auto-generated value (a string UID in fact).
I've declared this field as required with
Code:
@Column(nullable = false, unique = true)
But if the field is required, it cannot reach the
PreInsertEventListener:
Code:
org.hibernate.PropertyValueException: not-null property references a null or transient value: [...].User.uid
I have to removed
nullable = false to be able to set the UID et store the entity to DB.
Is it normal that the validation is done before the
PreInsertEventListener is called ?
Thanks for your help.
Cedric