-->
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: Column attributes or Validator constraints?
PostPosted: Fri Sep 07, 2007 11:59 am 
Newbie

Joined: Wed Dec 22, 2004 11:36 am
Posts: 11
This is a more basic design question with reference to the direction Hiberate is going.

Hibernate annotations define @Column with length and nullable
Hibernate validator defines @Length, @Max, @NotNull

According to the docs...
"Out of the box, Hibernate Annotations will translate the constraints you have defined for your entities into mapping metadata. For example, if a property of your entity is annotated @NotNull, its columns will be declared as not null in the DDL schema generated by Hibernate."

So, from the perspective of the schema, does it matter whether you use @Column.length or @Length to annotate your field? What if you declare both? (I do realize that @Length enables you to use the validator framework (in classes or view). Is one decision better than the other?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 11, 2007 4:50 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I think using the HV descriptor is a better decision. You will be able to validate at different levels, and hopefully that's the way the spec will go.

Technically speaking, the HV annotations will override the JPA annotations (for example if you have 2 different lengths).

_________________
Emmanuel


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.