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 an inverse date like '20130301'. Mapped onto this table i have a class GameCycle that holds a protected field iDate of type java.util.Date. That field is annotated '@Type(type = "inverseDate")', using a custom type mapping. The class Gamecycle is annotated with '@TypeDef(name = "inverseDate", typeClass = InverseDateType.class)'
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
@Entity
@TypeDef(name = "inverseDate", typeClass = InverseDateType.class)
@Table(name = "GAMECYCLE")
public class GameCycle implements Comparable<GameCycle>, Serializable
{
@Type(type = "inverseDate")
@Column(name = "GC_DATE", nullable = false)
protected Date iDate = null;
...
Obviously, the imports bind me to using hibernate as a jpa implementation so my question is:
Is there a way to get rid of the hibernate annotations and do the same custom type mapping using a pure javax.persistence solution ?