title: JPA Array index out of range
body: <p>I am using JPA in my WAS 6.1. I try to execute this line:  </p>
  
  <pre><code>@Entity
  @Table(name="some_Table")
  @NamedQueries({
  @NamedQuery(name="getAllAccountTypeService",
  query="SELECT a FROM AccountTypeServiceAssoc a " +
  "WHERE a.delete.deletedDate IS NULL ")
  
  .....
  
  Query query = em.createNamedQuery("getAllAccountTypeService");  
  return query.getResultList();
  </code></pre>
  
  <p>I get this on my SystemOut.log:
   <code>org.apache.openjpa.persistence.PersistenceException: Array index out of range: 48</code></p>
  
  <p>Where is the array in the above code that is going out of range? The error comes in this Line #100:</p>
  
  <p>EnumValueHandler.java(This is a jpa class)</p>
  
  <pre><code> public Object toObjectValue(ValueMapping vm, Object val) {
     97           if (val == null)
     98               return null;
     99           if (_ordinal)
    100               return _vals[((Number) val).intValue()];
    101           return Enum.valueOf(vm.getType(), (String) val);
    102       }
  </code></pre>
  
  <p>I cannot figure out what is <code>_vals</code> and what is <code>val</code>
  Thank you for your help.</p>
  
  <p>EDIT: Thank you for the answer. The column is indeed mapped to an ordinal like this:  </p>
  
  <p>@Column(name="SVC_ID")
  @Enumerated(EnumType.ORDINAL)
  protected ServiceType service;</p>
  
  <p>But where do we set the range of the Ordinal? That makes 48 outside the range.</p>