About Java and JRuby Development
JEE, Spring, Guice
Hibernate, Java Persistence (JPA)
and various Web Frameworks

@javax.persistence.Enumerated

hibernate buch cover klein

Extract of the annotation reference in the Hibernate Developer Guide by example


Extensive, easy-to-follow introduction to Hibernate 3 including complete working examples. Integration of Hibernate with other technologies like Spring, EJB3, Struts and JavaServer Faces (MyFaces) is explained.


It is available as PDF in English language.
A German paper book was published by the Galileo Verlag.


Get more information.

@javax.persistence.Enumerated(

beschreibt ein Attribut als Enum – Typen

value = EnumType.STRING

m�gliche Werte sind: EnumType.STRING oder
EnumType.ORDINAL



STRING bewirkt, dass Hibernate eine
Tabellenspalte vom Typ char erzeugt, die den Enum-Typen als
Zeichenfolge enth�lt: ForestType.JUNGLE = Spaltenwert JUNGLE.



ORDINAL bewirkt, dass Hibernate eine
Tabellenspalte vom Typ Integer erzeugt. für jeden Typ
wird eine Zahl gespeichert. Bei diesem Ansatz k�nnen Sie neue
Typen nur am Ende einf�gen, da sonst die Zuordnung von Zahl
zu Typ durcheinander.

)


public
enum ForestType {JUNGLE, FOREST, NORDIC}



@Enumerated(EnumType.STRING)



private
ForestType forestType;