-->
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: PreInsertEventListener and required field validation
PostPosted: Tue Jun 12, 2007 12:44 pm 
Newbie

Joined: Fri Feb 10, 2006 2:20 pm
Posts: 9
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


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.