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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:40:03+00:00 2026-06-10T19:40:03+00:00

I tried various things, e.g. most simple: // Value object @Embeddable @NoSql(dataFormat=DataFormatType.MAPPED) public class

  • 0

I tried various things, e.g. most simple:

// Value object
@Embeddable
@NoSql(dataFormat=DataFormatType.MAPPED)
public class Attribute implements Serializable {

   @Basic
   private String someProp;

   // ... getter/setter omitted
}

@Entity
@NoSql(dataFormat=DataFormatType.MAPPED)
public class FancyEntity implements Serializable {

   @Id
   @GeneratedValue
   @Field(name="_id")
   private String id;

   @ElementCollection
   private Map<String,Attribute> attributes = new HashMap<>();

   // ... getter/setter omitted
}

but this produces the error:

Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.4.1.v20120825fb0a20b): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [myPersistenceUnit] failed.
Internal Exception: java.lang.ClassCastException: org.eclipse.persistence.eis.mappings.EISCompositeCollectionMapping cannot be cast to org.eclipse.persistence.mappings.foundation.MapComponentMapping
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:221)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:1541)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1532)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:208)

Any idea?

I am using latest 2.4.1-SNAPSHOT on Glassfish 3.1.2.

Solution

Add the @MapKey annotation and choose the desired key field within your embeddable class:

   @ElementCollection
   @MapKey(name="name")
   private Map<String,Attribute> attributes = new HashMap<>();
  • 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-10T19:40:04+00:00Added an answer on June 10, 2026 at 7:40 pm

    You should be able to use a @MapKey to define the map key from the Attribute object (I assume its name).

    @MapKeyColumn, @MapKeyJoinColumn and @MapKeyClass are not supported by EclipseLink’s current NoSQL support.

    Please log a bug about the exception though, you should get a better error, or the map key should be defaulted better.

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

Sidebar

Related Questions

I've tried various things and googled multiple hours but couldn't find a solution to
Input: $string = this-is-just-an--example Output: this is just an-example Tried various things centered around
I have tried all of these various ways to set the value of the
I've tried various things but the boxes on the right have a spacing issue
I've tried various things and nothing is working out quite like it should. I've
I have spent several hours on this, and tried various things. I can confirm
I have searched the documentation and tried various techniques but have't found a suitable
I need help with some CSS styling. I've tried various options with Firebug and
I'm trying to compile Python 2.6 for 64bit, I tried various compile commands but
I know this won't work. I tried it in various forms and failed all

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.