This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Repeated column in mapping for entity

Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am trying to do an application in JPA with hibernate. But i am getting Repeated column in mapping for entity exception in my code. Please help me to correct if i am wrong in my code.

public class RegisterBean
private String userName,password;

private long userID;
private Date dob;
private AddressClass homeAddressClass;
private AddressClass officeAddressClass;


public long getUserID()
return userID;

public void setUserID(long userID)
this.userID = userID;
public Date getDob() {
return dob;

public void setDob(Date dob) {
this.dob = dob;

public String getUserName()
return userName;

public void setUserName(String userName)
this.userName = userName;

public String getPassword()
return password;

public void setPassword(String password)
this.password = password;

public AddressClass getHomeAddressClass() {
return homeAddressClass;

public void setHomeAddressClass(AddressClass homeAddressClass) {
this.homeAddressClass = homeAddressClass;

public AddressClass getOfficeAddressClass() {
return officeAddressClass;

public void setOfficeAddressClass(AddressClass officeAddressClass) {
this.officeAddressClass = officeAddressClass;


public class AddressClass
private String street;
private String state;
private Long houseNo;

public String getStreet()
return street;
public void setStreet(String street)
this.street = street;

public String getState()
return state;
public void setState(String state)
this.state = state;

public Long getHouseNo()
return houseNo;
public void setHouseNo(Long houseNo)
this.houseNo = houseNo;


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"

<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/shop</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1000</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

<!-- Enable Hibernate's automatic session context management -->
<!-- <property name="current_session_context_class">thread</property> -->

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup -->
<property name="">create</property>
<mapping class="com.all.RegisterBean" />


public class HibernateCall
public static void main(String[] args)
RegisterBean registerBean=new RegisterBean();
AddressClass homeAddressClass=new AddressClass();
AddressClass officeAddressClass=new AddressClass();

registerBean.setDob(new Date());
SessionFactory sessionFactory=new Configuration().configure().buildSessionFactory();
Session session=sessionFactory.openSession();


error is

Exception in thread "main" org.hibernate.MappingException: Repeated column in mapping for entity: com.kjc.all.RegisterBean column: houseNo (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(
at org.hibernate.mapping.PersistentClass.validate(
at org.hibernate.mapping.RootClass.validate(
at org.hibernate.cfg.Configuration.validate(
at org.hibernate.cfg.Configuration.buildSessionFactory(
at org.hibernate.cfg.Configuration.buildSessionFactory(
at com.all.MainClass.main(

i checked with insertable=false and updatable=false. even it is not worked for me.

any help will be appreciatable. Thanks in advance
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic