is there a way how I can get MetaData about my Hibernate Annotations?
I need information about Associations if they are nullable or not.
Right now I can only query for ClassMetadata
http://docs.jboss.org/hibernate/core/3.5/javadocs/org/hibernate/metadata/ClassMetadata.html
Where I can run through the properties and check if it is a
EntityType
http://docs.jboss.org/hibernate/core/3.5/javadocs/org/hibernate/type/EntityType.html
or CollectionType
http://docs.jboss.org/hibernate/core/3.5/javadocs/org/hibernate/type/CollectionType.html
EntityType apparently has a isNullable function but not CollectionType
So I thought about using the Annotation information
@GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "seizureI18n"))
@Id
@GeneratedValue(generator = "generator")
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
Is this possible or maybe another way to achieve what I want.
Regards
JS
I am not sure I understand your question, but if you want to see if an annotation is present you could do like this (using introspection):