-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: org.hibernate.MappingException: Repeated column in mapping
PostPosted: Tue Jun 18, 2013 10:19 am 
Newbie

Joined: Tue Jun 18, 2013 10:11 am
Posts: 1
I am new to Hibernate . I am getting the below exception while executing. Can anyone please help to resolve the problem

Here is the hbm file:

package org.java.dto;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.AttributeOverrides;
import javax.persistence.AttributeOverride;
import javax.persistence.Column;

@Entity
@Table(name="USER_DETAILS")
public class UserDetails {
@Id @GeneratedValue(strategy=GenerationType.AUTO)
private int userId;
private String userName;


@Embedded
@AttributeOverrides({
@AttributeOverride (name="street",column=@Column(name="HOME_STREET_NAME")),
@AttributeOverride (name="city",column=@Column(name="HOME_NAME_CITY")),
@AttributeOverride (name="state",column=@Column(name="HOME_STATE_NAME")),
@AttributeOverride (name="pincode",column=@Column(name="HOME_PIN_CODE"))

})

public Address getHomeAddress() {
return homeAddress;
}
public void setHomeAddress(Address homeAddress) {
this.homeAddress = homeAddress;
}
public Address getOfficeAddress() {
return officeAddress;
}
public void setOfficeAddress(Address officeAddress) {
this.officeAddress = officeAddress;
}
private Address homeAddress;
@Embedded
private Address officeAddress;


public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}

public String getUserName() {
return userName ;
}
public void setUserName(String userName) {
this.userName = userName;
}


}



Error is as follows:


SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" org.hibernate.MappingException: Repeated column in mapping for entity: org.java.dto.UserDetails column: CITY_NAME (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:676)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:698)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:694)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:720)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:474)
at org.hibernate.mapping.RootClass.validate(RootClass.java:235)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1362)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1865)
at org.kavya.hibernate.HibernateTest.main(HibernateTest.java:41)


Thanks in advance!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.