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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:46:57+00:00 2026-05-20T02:46:57+00:00

i want to Map a map in JPA, but I get a Exception: My

  • 0

i want to Map a map in JPA, but I get a Exception:
My java-code looks like that:

Issue.java:

@ElementCollection
@CollectionTable(
    name="ISSUE_EMPLOYEE",
    joinColumns=@JoinColumn(name="ISSUE_ID", referencedColumnName="ID")
)
@MapKeyColumn(name="EMPLOYEEPOSITION_ID")
@MapKeyConvert("myEnumConverter")
@JoinColumn(name="EMPLOYEE_ID")
private Map<EmployeePosition, Employee> namedEmployees = new Hashtable<EmployeePosition, Employee>();

EmployeePosition is a Enum andEmployee is a Entity.

I get this Exception :

Internal Exception: java.sql.SQLException: ORA-00904: “EMPLOYEES”: invalid identifier

Error Code: 904
Call: INSERT INTO ISSUE_EMPLOYEE (ISSUE_ID, EMPLOYEES, EMPLOYEEPOSITION_ID) VALUES (?, ?, ?)
bind => [27, [B@18b85d, SERVICE]

It seems to ignore the @JoinColumn annotation and tries to insert the object in the DB.
What´s wrong with my mapping/Is it possible to match Entities like this?

  • 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-20T02:46:57+00:00Added an answer on May 20, 2026 at 2:46 am

    As far as I understand, you need @OneToMany instead of @ElementCollection when value of a Map is an entity. Something like this:

    @OneToMany
    @JoinTable(name = "ISSUE_EMPLOYEE",
        joinColumn = @JoinColumn(name = "ISSUE_ID"),
        inverseJoinColumn = @JoinColumn("EMPLOYEE_ID"))
    @MapKeyColumn(name="EMPLOYEEPOSITION_ID") 
    private Map<EmployeePosition, Employee> namedEmployees = new Hashtable<EmployeePosition, Employee>(); 
    

    EDIT: The mapping above works fine in Hibernate, but doesn’t work in EclipseLink. EMPLOYEEPOSITION_ID column in ISSUE_EMPLOYEE is created, but not used in queries. It happens not only with enum keys, but also with other primitive types.

    It looks like a bug in EclipseLink. I can’t find in in their Bugzilla, so perhaps it would be better to report it.

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

Sidebar

Related Questions

My User table I want to map to aspnet_Users: <class name=User table=`User`> <id name=ID
I have one very general object that I want to map to a destination
I want map my object from text file, the text file contents are like
I want to map all properties that match between two class instances. public class
Using a ClassPathXmlApplicationContext object I want to get the same EntityManager that is being
I want map a List of beans to a JTable. The idea is that
Let's pretend that we want to build an eBay like app in which we
I want to map a route like this: mysite.com/username in ASP.NET MVC 3 application;
I have a single java bean, which is already annotated for JPA, that I
I want to map a function that takes two arguments over two vectors of

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.