Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7129093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:12:24+00:00 2026-05-28T11:12:24+00:00

I am using JPA in my WAS 6.1. I try to execute this line:

  • 0

I am using JPA in my WAS 6.1. I try to execute this line:

@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();

I get this on my SystemOut.log:
org.apache.openjpa.persistence.PersistenceException: Array index out of range: 48

Where is the array in the above code that is going out of range? The error comes in this Line #100:

EnumValueHandler.java(This is a jpa class)

 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       }

I cannot figure out what is _vals and what is val
Thank you for your help.

EDIT: Thank you for the answer. The column is indeed mapped to an ordinal like this:

@Column(name=”SVC_ID”)
@Enumerated(EnumType.ORDINAL)
protected ServiceType service;

But where do we set the range of the Ordinal? That makes 48 outside the range.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:12:25+00:00Added an answer on May 28, 2026 at 11:12 am

    One of the fields of the entities that are loaded is an enum, mapped as ordinal.

    This means that the ordinal of the enum is stored in the database, and is used when loading the object to find the corresponding enm instance.

    And instead of one of the valid ordinals (from 0 to 4 if there are 5 values for that enum), the cell in the database contains the value 48 (which would require en enum with at least 49 instances).

    In short, the data in the database is invalid, or should not be mapped with an enum.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While I try to save top level entity (using JPA), do I need to
I'm using JPA (Hibernate's implementation) to annotate entity classes to persist to a relational
I'm using JPA (not JDO) on Google App Engine and this is a typical
I'm using Hibernate with JPA and have a relationship that looks like this: public
I've switched from using Spring Data JPA for regular DAO objects with Entity Manager
I have an entity (JPA annotations with Hibernate query interface) which has a composite
This may be a very stupid question, but... I'm using JPA 2.0 with Hibernate
Using JPA with EclipseLink implementation. Code: try{ if(!em.getTransaction().isActive()) em.getTransaction().begin(); System.out.println(2); em.persist(currentUser); System.out.println(3); if (em.getTransaction().isActive()){
This is similar to How to cascade persist using JPA/EclipseLink I have to entities
I'm trying to update an entity using JPA with Google App Engine. I start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.