Hibernate version:
hibernate-3.2, hibernate-annotations-3.3.0.GA,
hibernate-validator-3.0.0.GA
Mapping documents:
none (annotations)
Hi everyone,
For testing I have made an annotated class like so:
Code:
import javax.persistence.*;
import org.hibernate.validator.*;
@Entity
@Table(name="person")
public class Person
{
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
long id;
@Column( length=128 )
@Length( min=5, max=128 )
@Email
String email;
}
How would I go about obtaining the Annotation Metadata from this class from within my program?
I'd like to write a small presentation framework and that needs
to learn about the constraints for each field to do its thing.
I figured out how I can get at the basic
Column's via
Configuration.getClassMapping(..).getIdentityTable(..).getColumn(..).
But those only seem to give me the classname and @Column( length ),
most other getters return null for my little testclass (even
getSqlType(), i wonder why?).
But how do I get the data for @Length( min/max ), @Email, @Id and
other Annotations?
Any help would be very appreciated.