- @Enumerated(EnumType.STRING) writes ordinal to table 2007-08-12 - By tynor
Back 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 @(protected) to set the STRING converstion:
@(protected)(name = "audit_event") | @(protected)(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 __ ____ ____ ____ ____ ____ ____ ____ ____ ____ jboss-user mailing list jboss-user@(protected) https://lists.jboss.org/mailman/listinfo/jboss-user
|
|