The attached case shows Serializable and non-serializable entity classes, all enums are mapped to tinyblob types. The @Basic and @Enumeration annotations seem to be ignored. This is breaking existing applications that rely on the EnumType.ORDINAL mapping as stated in JSR-338. @Entity @Access(AccessType.FIELD) public class Book implements Serializable { private static final long serialVersionUID = 1L; @Column private String author; @Column private String code; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column private String name; @Column @Lob private byte[] pdf; @Column private BookType type; .... } public enum BookType {Used, New} After deploying the ear file: mysql> desc book; ---------------------------------------+
Field |
Type |
Null |
Key |
Default |
Extra |
---------------------------------------+
id |
bigint(20) |
NO |
PRI |
NULL |
|
author |
varchar(255) |
YES |
|
NULL |
|
code |
varchar(255) |
YES |
|
NULL |
|
name |
varchar(255) |
YES |
|
NULL |
|
pdf |
longblob |
YES |
|
NULL |
|
type |
tinyblob |
YES |
|
NULL |
|
---------------------------------------+ 6 rows in set (0.02 sec) Notice the tinyblob type in book table. Am I doing something wrong here? How can I make sure that hibernate maps my enums as ordinals? Thanks, Juan |