title: Enum is not a valid type for an enumerated mapping
body: <p>I'm having a real head-scratcher over the following exception which is thrown when I try and deploy my webapp to a Glassfish container (both static shell and server). Basically, I have an entity class which has the following property:</p>
  
  <pre><code>    @Entity
      public class Anniversary implements Serializable, Comparable&lt;Anniversary&gt;
      {
       ...
  
          @Enumerated
          private AnniversaryType type;
  
       ....Rest of class
       }
  </code></pre>
  
  <p>Which refers to an enumerated class that is declared as follows:</p>
  
  <pre><code> public enum AnniversaryType
  </code></pre>
  
  <p>The program builds without complaint in Netbeans 8.0 using a standard Maven project, but when it is deployed the following exception is thrown:</p>
  
  <pre><code>Caused by: Exception [EclipseLink-7151] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd):         org.eclipse.persistence.exceptions.ValidationException
  Exception Description: The type [class com.mycompany.anniversaries_final.AnniversaryType] for the   attribute [type] on the entity class [class com.mycompany.anniversaries_final.Anniversary] is not a     valid type for an enumerated mapping. The attribute must be defined as a Java enum.
  at org.eclipse.persistence.exceptions.ValidationException.invalidTypeForEnumeratedAttribute(ValidationException.java:1125)
  at org.eclipse.persistence.internal.jpa.metadata.converters.EnumeratedMetadata.process(EnumeratedMetadata.java:115)
  at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processEnumerated(MappingAccessor.java:1684)
  at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicAccessor.processEnumerated(BasicAccessor.java:467)
  at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processMappingConverter(MappingAccessor.java:1769)
  at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processMappingValueConverter(MappingAccessor.java:1796)
  at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicAccessor.process(BasicAccessor.java:419)
  at org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor.processMappingAccessors(MetadataDescriptor.java:1536)
  at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.processMappingAccessors(ClassAccessor.java:1648)
  at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processMappingAccessors(EntityAccessor.java:1234)
  at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.process(EntityAccessor.java:697)
  at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage2(MetadataProject.java:1793)
  at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:576)
  at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:585)
  at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1869)
  ... 64 more
  </code></pre>
  
  <p>. I am baffled! I have looked at both of the following answers: 
  <a href="https://stackoverflow.com/questions/13526760/jpa-and-enum-type">JPA and enum type</a> and <a href="https://stackoverflow.com/questions/6101727/jaxws-and-eclipselink-refuses-to-use-enums-from-lib">jaxws and EclipseLink refuses to use enums from lib</a> both of which offer answers if the class is in a separate jar file,but in my case it is not (as far as I know). I did have another issue with this enum elsewhere in the app where I was using it as a map key and had to explicitly name the table and key values as per <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=364922" rel="nofollow noreferrer">https://bugs.eclipse.org/bugs/show_bug.cgi?id=364922</a>.</p>
  
  <p>I'm totally stumped....any help would be greatly appreciated!</p>