java - hibernate saving enum and retrieve values? -
i have enum below.
public enum testenum { example, further_example, last_example }
with mapping in .hbm:
<property name="testenum" column="test_column"> <type name="org.hibernate.type.enumtype"> <param name="enumclass">p.a.c.k.testenum</param> </type> </property>
the enum sent database 0, 1, 2. fine. when retrieve same results need example, further_example, last_example instead of 0,1,2. how can that? please me!
based on answer in reply of comment.
you want access enum value enum ordinal. if so, can use below code.
testenum value = testenum.values()[ordinal] //ordinal can position talking about.
if not want, forget answer, if looking for, +1 it.
Comments
Post a Comment