[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-472?page=co...
]
Ted Bergeron commented on ANN-472:
----------------------------------
I am using Hibernate Validator. I do understand I can go on my own and create propritary
annotations to solve the reflection part of the problem. This will not solve the part
about not being able to declare composite unique constraints in abstract base classes.
Further, the wish to see what validation restrictions are in place for an object without
having to populate the object and run it throught the ClassValidator is a general desire
that can many Hibernate users can benefit from.
I have not checked to see if the ClassValidator would actually generate Select statements
to validate single column and/or composite unique constraints. (I will be very impressed
if it does.) I was thinking that it was limited to the checks in section 4.1.2 of the
documentation.
@UniqueConstraint declaration is not friendly towards inheritance or
reflection
-------------------------------------------------------------------------------
Key: ANN-472
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-472
Project: Hibernate Annotations
Type: Improvement
Versions: 3.2.0.ga
Environment: Hibernate 3.2 GA
Reporter: Ted Bergeron
The current way to define a composite unique constraint is limiting.
@Table(name="tbl_sky",
uniqueConstraints = {@UniqueConstraint(columnNames={"month",
"day"})}
)
Suppose I have an abstract base class called A that gives me Id and Name, subclassed by
abstract class B that gives me Customer. Then I have many concrete classes that subclass
B. For all of these, I'd want the combination of Name and Customer to be unique. As
I do not use @Table with abstract base classes, I currently have to repeat:
uniqueConstraints = {@UniqueConstraint(columnNames={"name",
"customer_id"})} on all concrete classes.
If we had an alternate way to define these constraints at the property level (as XDoclet
did with hibernate 2), I could define this in the base classes and inherit the constraint
declaration.
The other need is that I would like to use reflection to scan the properties and apply
proper validations in the view layer. With @Column(unique = true) this is easy to do.
The view layer makes an AJAX call and all is well. For a composite constraint, it does
not work well currently.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira