| Author |
Repeated column in mapping for entity: insert="false" update="false'
|
Sandeep Vaid
Ranch Hand
Joined: Feb 27, 2006
Posts: 390
|
|
Item - Bid bidirecitonal association I am getting the following error :
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
If you are going to map a field more than once in an object you'll nee to do as the error message says and define one of the mappings as read only.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Arun Kumarr
Ranch Hand
Joined: May 16, 2005
Posts: 504
|
|
|
Did you set the inverse relationships correctly.
|
If you are not laughing at yourself, then you just didn't get the joke.
|
 |
Hsitas Hickory
Greenhorn
Joined: Nov 09, 2009
Posts: 2
|
|
This also happens when the column name is repeated.
For example in the mapping hbm file,
<property name="school" column="schoolname" type="string"/>
<property name="grade" column="schoolname" type="string"/>
Here since the column ="cname" is used twice one for the school and one for the grade, this error happens
Initial SessionFactory creation failed.org.hibernate.MappingException: Repeated column in mapping for entity: Student column: schoolname (should be mapped with insert="false" update="false")
Exception in thread "main" java.lang.ExceptionInInitializerError
at HibernateUtil.<clinit>(HibernateUtil.java:41)
at Main.main(Main.java:20)
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: Student column: schoolname (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.checkColumnDuplication(PersistentClass.java:696)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:450)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
at HibernateUtil.<clinit>(HibernateUtil.java:37)
... 1 more
Java Result: 1
change it to
<property name="school" column="schoolname" type="string"/>
<property name="grade" column="grade" type="string"/>
|
 |
vasu chowdary
Ranch Hand
Joined: Mar 15, 2008
Posts: 74
|
|
declare insert="false" and update="false" in your mapping file(may be for your collection element) then try...............
|
 |
 |
|
|
subject: Repeated column in mapping for entity: insert="false" update="false'
|
|
|