1 Reply Latest reply on Aug 12, 2007 6:38 PM by steve tynor

    @Enumerated(EnumType.STRING) writes ordinal to table

    steve tynor Novice

      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 {

      My Entity property is marked with @Enumerated to set the STRING converstion:

      @Column(name = "audit_event")
       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?