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 8879859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:02:43+00:00 2026-06-14T20:02:43+00:00

I use for an JPA entity one field of enum type : @Enumerated(value=EnumType.STRING) private

  • 0

I use for an JPA entity one field of enum type :

@Enumerated(value=EnumType.STRING)
private Temperament temperament = Temperament.MINEUR_PUR;

My enum is declared inside my entity :

@Entity
public class Joueur implements Serializable {

.....

    public enum Temperament{
        MINEUR_PUR(30),
        MINEUR(10),
        NEUTRE(0),
        RAIDEUR(-10),
        RAIDEUR_PUR(-30);

        private int temperament_prod_mines;

        private Temperament(int temperament_prod_mines){
            this.temperament_prod_mines = temperament_prod_mines;       
        }

        public int getTemperament_prod_mines() {
            return temperament_prod_mines;
        }

        public void setTemperament_prod_mines(int temperament_prod_mines) {
            this.temperament_prod_mines = temperament_prod_mines;
        }
    }   
}

it’s work but when I “externalize” my enum in it’s own file, it doesn’t work anymore :

Caused by: Exception [EclipseLink-7151] (Eclipse Persistence Services – 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class com.sim.basics.enums.Temperament] for the attribute [temperament] on the entity class [class com.sim.entities.Joueur] is not a valid type for an enumerated mapping. The attribute must be defined as a Java enum.

but it’s just a copy/paste…

Why this behaviour ?

Thanks

  • 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-06-14T20:02:44+00:00Added an answer on June 14, 2026 at 8:02 pm

    One cause of this problem is that the enumeration defined in enum.jar is in runtime not found on the classpath by the entity.

    There are atleast two ways to solve this.

    1. In META-INF/MANIFEST.MH of entity.jar

      classpath: enum.jar

    2. Or to specify the enum.jar as part of the EAR if you use maven.

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

Sidebar

Related Questions

When I use the unit of work pattern (with JPA), I get an entity
For simple string field, @Entity class Foo { //1. @Basic(optional = false) //2. @Column(length
I use JPA 2 with Hibernate. There are two entity classes, CardElement and IdentityDocumentKind
When I do a relation one to one with to entities, JPA use the
With JPA, we can use manually OPTIMISTIC or PESSIMISTIC locking to handle entity changes
I'm trying to use JPA with GWT. My serviceImpl calls UserDAO.exists(user); When I run
I'd like to use JPA over JDBC for a new application. I'm strictly using
I am starting to use JPA and I always get confused with the term
Is there any way I can use JPA or hibernate annotations to specify the
I have a lot of entities in application and I use JPA implementation for

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.