I have a table GameCycle in a db that holds a column date of type number. The values in this column are 8-digit numbers representing a
Custom Type Mapping has been finally added in JPA 2.1 (JSR-388, part of Java EE 7).
The Hibernate's @Type annotation is no longer needed, and can be replaced by Type Conversion in JPA 2.1.
JPA 2.1 has added :
The most basic example : (Example 1: Convert a basic attribute) - from source
@Converter
public class BooleanToIntegerConverter
implements AttributeConverter
{ ... }
...
@Entity
@Table(name = "EMPLOYEE")
public class Employee
{
@Id
private Long id;
@Column
@Convert(converter = BooleanToIntegerConverter.class)
private boolean fullTime;
}
Other links :