-->
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: PrePersist/PreUpdate should happen before validation?
PostPosted: Tue Jul 12, 2005 1:00 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:47 pm
Posts: 44
Hibernate does property validation such as not null checking before it does the EJB3 callback to prepersist/preupdate. I'm not sure if there's a good reason for this, but I think it would be particularly convenient if this behavior was reversed. IMHO it seems to better fit the semantics of the PRE callbacks, and it would allow callbacks to make modifications to the objects before they are persisted or updated -- modifications that might in turn effect the property validation Hibernate is doing.

The "audit" example in the entity manager documentation does make changes to the object. What if these changes had effected the property validation done before the callback occurred? What if the object was in an invalid state before the callback, but a valid state after the callback? The latter case is what I think would be conveniently handled if hibernate did its property validation after prepersist/preupdate.

Just two cents worth, obviously there are workarounds. This EJB3 stuff is looking great.

Ryan

P.S. This might also allow those of us who assign our own IDs to objects to do so automatically within a callback.


Top
 Profile  
 
 Post subject: Same issue here
PostPosted: Mon Aug 08, 2005 5:05 am 
Beginner
Beginner

Joined: Mon May 16, 2005 6:06 am
Posts: 20
Hi,
I have the same opinion as you. I created an Jira entry: http://opensource.atlassian.com/project ... wse/EJB-46

Cheers,
Johan


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.