enum « Field « JPA Q&A





1. hibernate - How to annotate a property as enum with a field    stackoverflow.com

How do I map an enum with a field in it?

public enum MyEnum{
HIGHSCHOOL ("H"), COLLEGE("C")
private int value;
public MyEnum getInstance(String value){...}
}

@Entity
public class MyEntity {
@Enumerated(...)
private MyEnum eduType;
}
How do I annotate so that values ...

2. Enum as datatype for fields    forum.hibernate.org

Hello! I would like to use an enum as datatype for a field and i already found some basic instructions on how to do this on google. I don't want to use annotations, so the xml way is the only one i can go. I have found a class GenericEnumUserType on http://community.jboss.org/wiki/Java5EnumUserType which probably works as i need it. My xml ...

3. Configuring Enum to Integer field    forum.hibernate.org

Hi All, I've been looking around the net to no avail. I'm pretty sure im missing something simple here. I have a field in db, that is of type int. I'm trying to properly map, using annotations the enum property. Code: @Entity @Table(name = "MyTable") public class myClass implements Serializable { @Id ...