[jboss-user] [EJB 3.0] - @Enumerated(EnumType.STRING) writes ordinal to table
tynor
do-not-reply at jboss.com
Sun Aug 12 12:24:12 EDT 2007
JBoss AS 4.2.1
I'm trying to persist an enum as a string (e.g. "OBJECT_CREATE" rather than its ordinal 0):
public enum AuditEvent {
| OBJECT_CREATE,OBJECT_UPDATE,OBJECT_REMOVE,FIELD_CHANGE,
| }
My Entity property is marked with @Enumerated to set the STRING converstion:
@Column(name = "audit_event")
| @Enumerated(EnumType.STRING)
| public AuditEvent getEvent() {...
The generated table is (correctly) a VARCHAR (without the STRING annotation, it is an int), but the value written to the table is still the ordinal value (the string '0' rather than the string 'OBJECT_CREATE').
Is this a bug in JBoss 4.2.1, or a misunderstanding of the spec on my part?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073384#4073384
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4073384
More information about the jboss-user
mailing list