-->
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.  [ 7 posts ] 
Author Message
 Post subject: Validation exceptions don't have a comment superclass
PostPosted: Thu Apr 20, 2006 9:21 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
I am using hibernate annotations and it's validator, which is really usefull.

On one property I have the following annotations:
@NotNull @length(min = 1)

When I set this property to null I get:
org.hibernate.PropertyValueException: not-null property references a null or transient value

When I set this property to "" I get a:
org.hibernate.validator.InvalidStateException: validation failed for:


From a hibernate user's perspective, both are validation exceptions, only because not null of table schema is checked before the validations, the not null doesn't give a InvalidStateException too.
But it should, shouldn't it?

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 9:57 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
it's actually due to the hibernate core lifecycle and the way Hibernate Validator integrates in it. I need to think about it hard, but this is not easy to workaround

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 3:36 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
Is there a JIRA issue for this I can track or shall I make one?

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 25, 2006 2:33 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
there is one already in the validator component

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 02, 2006 8:27 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
I just encountered a different problem, which leads me to believe that validation should occur a lot sooner to solve this problem too:

class Person {
private Address address; // composition: cascade all + eager

@NotNull private PersonType persontype;
...
}


When I create a new Person (with a new Address) and save my Person with a null persontype I get and exception (as expected), but my address object has changed: now my address has the non-null id 5. So when my user fills in the personType, the Person cannot be safed because the adress 5 wasn't safed in the database, but the id 5 leads hibernate to believe that it already exists in the database.

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 02, 2006 9:42 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
PS: I coudn't find the issue you where talking about in JIRA for Hibernate Annotations, component validator with any resolution

ANN-111 is a different issue, right?

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 22, 2006 8:26 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
FYI

http://opensource.atlassian.com/project ... se/ANN-396 is the correct issue

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.