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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:05:51+00:00 2026-05-30T23:05:51+00:00

There is a mapping exception for a particular entity. Cant figure out from where

  • 0

There is a mapping exception for a particular entity.
Cant figure out from where the problem is arising.
I checked all the mappings 3 times from start to end.
Still i am getting a Mapping Exception.

Email to employee is mapped only once.
but still it is reporting the error repeated mapping

Error is:

Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.cluster.entity.Email column: EMPLOYEE_ID (should be mapped with insert="false" update="false")
    at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:680)
    at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:702)
    at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:724)
    at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:477)
    at org.hibernate.mapping.RootClass.validate(RootClass.java:268)
    at org.hibernate.cfg.Configuration.validate(Configuration.java:1287)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1729)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1775)
    at com.cluster.util.HibernateUtil.<clinit>(HibernateUtil.java:16)
    ... 1 more

Email Pojo

package com.cluster.entity;

public class Email {

    private int intEmailID;
    private String strEmailName;

    //many to one
    private EmailType emailType;

    //many to one
    private Employee employee;

    public int getIntEmailID() {
        return intEmailID;
    }

    public void setIntEmailID(int intEmailID) {
        this.intEmailID = intEmailID;
    }

    public String getStrEmailName() {
        return strEmailName;
    }

    public void setStrEmailName(String strEmailName) {
        this.strEmailName = strEmailName;
    }

    public EmailType getEmailType() {
        return emailType;
    }

    public void setEmailType(EmailType emailType) {
        this.emailType = emailType;
    }

    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

}

email.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
        '-//Hibernate/Hibernate Mapping DTD 3.0//EN'
        'http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd'>


<hibernate-mapping package="com.cluster.entity" >
    <class name="Email" table="EMAIL">

        <id name="intEmailID" column="EMAIL_ID"> 
            <generator class="sequence">
                <param name="sequence">EMAIL_ID_SEQ</param>
            </generator>
        </id>

        <property name="strEmailName" column = "EMAIL_NAME"/>

        <many-to-one name="employee" column="EMPLOYEE_ID" not-null = "true" class = "Employee"/>

        <many-to-one name="emailType" column="EMAIL_TYPE_ID" not-null = "true" class = "EmailType"/>

    </class>

</hibernate-mapping>

Related Script

CREATE TABLE EMPLOYEE
(
  EMPLOYEE_ID      NUMBER                       NOT NULL,
  FIRSTNAME        VARCHAR2(20 BYTE)            NOT NULL,
  LASTNAME         VARCHAR2(20 BYTE)            NOT NULL,
  DATE_OF_BIRTH    VARCHAR2(20 BYTE)            NOT NULL,
  SALARY           VARCHAR2(10 BYTE)            NOT NULL,
  DEPARTMENT_ID    NUMBER                       NOT NULL
);


CREATE TABLE EMAIL
(
 EMAIL_ID              NUMBER              NOT NULL,
 EMAIL_NAME            VARCHAR2(40 BYTE)   NOT NULL,
 EMPLOYEE_ID           NUMBER              NOT NULL,
 EMAIL_TYPE_ID         NUMBER              NOT NULL
);


CREATE TABLE EMAIL_TYPE
(
 EMAIL_TYPE_ID         NUMBER              NOT NULL,
 EMAIL_TYPE_NAME       VARCHAR2(40 BYTE)   NOT NULL
);


ALTER TABLE EMPLOYEE ADD 
(
 CONSTRAINT PK_EMPLOYEE_ID
 PRIMARY KEY (EMPLOYEE_ID)
);

ALTER TABLE EMAIL_TYPE ADD 
(
 CONSTRAINT PK_EMAIL_TYPE_ID
 PRIMARY KEY (EMAIL_TYPE_ID)
);

ALTER TABLE EMAIL ADD
(
 CONSTRAINT PK_EMAIL_ID
 PRIMARY KEY (EMAIL_ID)
);

ALTER TABLE EMAIL ADD
( 
 CONSTRAINT FK_EMAIL_EMPLOYEE_ID
 FOREIGN KEY (EMPLOYEE_ID)
 REFERENCES EMPLOYEE (EMPLOYEE_ID)
);

ALTER TABLE EMAIL ADD
( 
 CONSTRAINT FK_EMAIL_EMAIL_TYPE_ID
 FOREIGN KEY (EMAIL_TYPE_ID)
 REFERENCES EMAIL_TYPE (EMAIL_TYPE_ID)
);

Email to employee is mapped only once.
but still it is reporting the error repeated mapping

  • 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-30T23:05:53+00:00Added an answer on May 30, 2026 at 11:05 pm

    have you set the collection in Employee as inverse?

    <bag name="emails" inverse="true">
      <key column="EMPLOYEE_ID" not-null="true">
      ...
    </bag>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to separate out the domain objects and mapping files into
What tool is there for generating C# classes from NHibernate mappings files?
I have configured global Exception mapping for java.lang.Exception and defined tiles results type. <global-exception-mappings>
Are there O/R mapping tools for ASP (not ASP.NET) and are these useful in
Is there a way of mapping data collected on a stream or array to
There seems to be three common approaches for mapping an application end user to
I was wondering if there was any key mapping in Vim to allow me
For methods where ... there exists a static one-to-one mapping between the input and
So, I'm working on a mapping application. In the app there are these toolbars
When manipulating Handler Mappings using the Microsoft.Web.Administration namespace, is there a way to remove

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.