I'm using Hibernate 2.1.4 and want to save Enumeration like this:
Code:
public class Side implements Serializable {
public static final Side INTRUDER = new Side("INTRUDER");
public static final Side GUARD = new Side("GUARD");
public static final Side NEUTRAL = new Side("NEUTRAL");
private String myName;
private Side() {
}
private Side(String name) {
myName = name;
}
public String toString() {
return myName;
}
}
In documentation I read that to do it I have to implement
net.sf.hibernate.PersistentEnum interface but this interface is deprecated in my Hibernate version. Somebody know hove I can save this enumeration?
P.S. I don't need save the enumeration I need save the link to item in this enumeration. For example, I need save next class:
Code:
public class SyntheticEntity {
private Side side;
public SyntheticEntity() {
this("", null, null, null);
}
public void setSide(Side side) {
this.side = side;
}
public Side getSide() {
return side;
}
}