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

  • Home
  • SEARCH
  • 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 244875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:02:29+00:00 2026-05-11T21:02:29+00:00

I’m trying to map an @Embeddable object in a subclass whose parent class already

  • 0

I’m trying to map an @Embeddable object in a subclass whose parent class already has a field of that @Embeddable type.

The hibernate Embeddable Objects documentation claims I can use the @AttributeOverrides to override the column names of an @Embeddable object:

e.g.

@Entity
public class Person implements Serializable {

    // Persistent component using defaults
    Address homeAddress;

    @Embedded
    @AttributeOverrides( {
            @AttributeOverride(name="iso2", column = @Column(name="bornIso2") ),
            @AttributeOverride(name="name", column = @Column(name="bornCountryName") )
    } )
    Country bornIn;
    ...
}

Here’s the case I have:

 @Embeddable
    public class ContentID implements Serializable {
        @Column(name="contentID")
        private String contentPath;
    }

   @MappedSuperclass
   public abstract class BaseDomainObject implements Serializable  {

       @Embedded
       private ContentID contentID;
    }

public class Achievement extends BaseDomainObject {

    @Embedded
    @AttributeOverrides( {
        @AttributeOverride(name="contentID", column = @Column(name="awardedItem") ),
    } )
    private ContentID awardedItem;
}   

The error I get is:

org.hibernate.MappingException:
Repeated column in mapping for entity:
Achievement column: contentID (should
be mapped with insert=”false”
update=”false”) at
org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:652)
at
org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:674)
at
org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:670)
at
org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:696)
at
org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:450)
at
org.hibernate.mapping.SingleTableSubclass.validate(SingleTableSubclass.java:43)
at
org.hibernate.cfg.Configuration.validate(Configuration.java:1108)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1293)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)

UPDATE:

I looked in for Hibernate issues relating to this and the GRAILS project claimed they fixed this issue but their annotation solution doesn’t seem to be valid javax.persistence annotations (maybe it’s a new version).

JPA @Embeddable/@Embedded throws org.hibernate.MappingException: Repeated column in mapping for entity

  • 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-11T21:02:29+00:00Added an answer on May 11, 2026 at 9:02 pm

    The problem seems to be this:

     public class ContentID implements Serializable {
        @Column(name="contentID")
        private String contentPath;
    }
    

    You are making the contentPath column name to be “contentId” and that is clashing with your AttributeOverride annotation later on.

    Try this:

    public class ContentID implements Serializable {
        @Column(name="contentPath")
        private String contentPath;
    }
    

    UPDATE
    I am also wondering about this:

    @Embedded
    @AttributeOverrides( {
        @AttributeOverride(name="contentID", column = @Column(name="awardedItem") ),
    } )
    private ContentID awardedItem;
    

    You seem to be changing the name of the contentId column here to awardedItem. Is that really necessary?

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

Sidebar

Ask A Question

Stats

  • Questions 209k
  • Answers 209k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer (Please note, that whilst the technique here is still somewhat… May 12, 2026 at 9:50 pm
  • Editorial Team
    Editorial Team added an answer Unfortunately, this is a bug in Firefox as it decodes… May 12, 2026 at 9:50 pm
  • Editorial Team
    Editorial Team added an answer If you are saving sessions (which you should if there's… May 12, 2026 at 9:50 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
In order to apply a triggered animation to all ToolTip s in my app,
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.