Well when i use the enum type and insert into database all type values starts from 0 not 1. Any easy fixes the +1 is not good solution.
The Enum class
public enum ServiceRequestType {
REGISTERED(1), REJECTED(2), DONE(3);
int value;
ServiceRequestType(int value) {
this.value = value;
}
}
Also the hibernate mapping.
<property name="type" column="service_request_status_type_fk">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">ee.ttu.support.model.domain.service.ServiceRequestType</param>
</type>
</property>
You can use java5 enum types. Check this link for perfect enum example with hibernate. Let me know if you have problems.