title: WildFly8 JPA2.1 and Enumerated values
body: <p>I am having problems with enumerated types with JPA2.1 (included in WildFly8). Here is the class using the set of enums:</p>
  
  <pre><code>@Entity
  @Table(name = "ZOO")
  public class Zoo extends BaseEntity {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      @Access(AccessType.PROPERTY)
      private Long id;
      private String name;
      @ElementCollection(targetClass = String.class, fetch = FetchType.EAGER)
      @CollectionTable(name = "ZOO_ANIMALS", joinColumns
          = @JoinColumn(name = "ZOO_ID", referencedColumnName = "ID"))
      @Enumerated(EnumType.STRING)
      private Set&lt;Animal&gt; animals = new HashSet();
  }
  </code></pre>
  
  <p>Then I have enumeration of the animals:</p>
  
  <pre><code>public enum Animal {
      PANDA,
      LION,
      ZEBRA,
      TIGER;
  }
  </code></pre>
  
  <p>Now when I try to start the server I am getting the following error:</p>
  
  <pre><code>[INFO] [talledLocalContainer] Caused by: org.hibernate.AnnotationException: Attribute [com.project.ejb.model.Zoo.animals] was annotated as enumerated, but its java type is not an enum [java.lang.String]
  [INFO] [talledLocalContainer]   at org.hibernate.cfg.annotations.SimpleValueBinder.setType(SimpleValueBinder.java:257)
  [INFO] [talledLocalContainer]   at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1370)
  [INFO] [talledLocalContainer]   at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:790)
  [INFO] [talledLocalContainer]   at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:725)
  [INFO] [talledLocalContainer]   at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:69)
  [INFO] [talledLocalContainer]   at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1675)
  [INFO] [talledLocalContainer]   at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1408)
  [INFO] [talledLocalContainer]   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1824)
  [INFO] [talledLocalContainer]   at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:854)
  [INFO] [talledLocalContainer]   ... 13 more
  [INFO] [talledLocalContainer] 
  </code></pre>
  
  <p>This worked ok with Jboss 7.1.1.Final. Should I use converter for this (<a href="http://somethoughtsonjava.blogspot.fi/2013/10/jpa-21-type-converter-better-way-to.html" rel="nofollow">http://somethoughtsonjava.blogspot.fi/2013/10/jpa-21-type-converter-better-way-to.html</a>) or what could be the problem? All help is appreciated!</p>