I noticed this problem has been posted before, but the <key-many-to-one> does not have 'insert' and 'update' attribute so I can set them to false. Is there a different way to appraoch this error when using <key-many-to-one>? As you can see below PROJECT_ID is used twice in wto different foreign key constraints.
Thanks in advance for any help
Hibernate version:
3.0
Mapping documents:
Code:
<class name="com.ProjectStepXref" table="PROJECT_STEP_XREF"
schema="PPDM37">
<composite-id name="id" class="com.ProjectStepXrefId">
<key-many-to-one name="ProjectStep"
class="com.ProjectStep">
<column name="PROJECT_ID" length="20" not-null="false" />
<column name="STEP_ID2" length="20" not-null="false" />
</key-many-to-one>
<key-many-to-one name="ProjectStep_1"
class="com.ProjectStep">
<column name="PROJECT_ID" length="20" not-null="false" />
<column name="STEP_ID1" length="20" not-null="false" />
</key-many-to-one>
<key-property name="XrefObsNo"
type="java.math.BigDecimal">
<column name="XREF_OBS_NO" length="8" not-null="true"
sql-type="NUMBER" />
</key-property>
</composite-id>
Code between sessionFactory.openSession() and session.close():
NA
Full stack trace of any exception that occurs:
09:56:28,000 INFO HbmBinder:1974 - Mapping collection: com.RTvdMethod.SetOfStratWellSection -> STRAT_WELL_SECTION
09:56:28,000 INFO HbmBinder:1974 - Mapping collection: com.RTvdMethod.SetOfStratFieldSection -> STRAT_FIELD_SECTION
09:56:28,000 INFO Configuration:865 - processing association property references
09:56:28,000 INFO Configuration:894 - processing foreign key constraints
%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: Repeated column in mapping for entity: com.ProjectStepXref column: PROJECT_ID (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:504)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:542)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:335)
at org.hibernate.mapping.RootClass.validate(RootClass.java:188)
at org.hibernate.cfg.Configuration.validate(Configuration.java:816)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1050)
at com.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:49)
at driver.Driver.main(Driver.java:24)
java.lang.NullPointerException
at com.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:56)
at driver.Driver.main(Driver.java:24)
Exception in thread "main"
Name and version of the database you are using:
Oracle 10g
The generated SQL (show_sql=true):
NA
Debug level Hibernate log excerpt:
NA