Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2
Mapping documents:
Code:
<class name="SupplierItem" table="supplieritem">
<id name="id" unsaved-value="null" type="string" length="32" access="field">
<generator class="uuid"/>
</id>
<version name="version" type="long" unsaved-value="null"/>
<property name="manufacturerPartNumber" type="string" access="field"/>
<map name="descriptions" access="field" lazy="true" cascade="all,delete-orphan">
<key column="supplieritemId" foreign-key="none" not-null="true"/>
<map-key formula="type" type="string"/>
<one-to-many class="SupplierItemDescription"/>
</map>
</class>
Code:
<class name="SupplierItemDescription" table="supplieritemdescription">
<id name="id" unsaved-value="null" type="string" length="32" access="field">
<generator class="uuid"/>
</id>
<version name="version" type="long" unsaved-value="null"/>
<many-to-one name="item" column="supplierItemId" class="SupplierItem" not-null="true" access="field"/>
<property name="type" type="string" not-null="true" access="field">
<column name="type" index="type_index"/>
</property>
<property name="text" type="string" length="65536" access="field"/>
</class>
Full stack trace of any exception that occurs:Code:
1204 DEBUG org.hibernate.SQL log [401] - insert into supplieritem (version, manufacturerPartNumber, supplierPartNumber, supplierImportNumber, uncorrectedWeight, uncorrectedCost, active, discontinued, correctedWeight, correctedCost, qtyAvailable, qtyBackordered, qtyOnOrder, correctedDeliveryLeadTime, uncorrectedDeliveryLeadTime, correctedBackOrderedDate, uncorrectedBackOrderedDate, creation, skuId, supplierId, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
1208 DEBUG org.hibernate.SQL log [401] - insert into supplieritemdescription (version, supplierItemId, type, text, supplieritemId, id) values (?, ?, ?, ?, ?, ?)
1229 DEBUG org.hibernate.SQL log [401] - insert into supplieritemdescription (version, supplierItemId, type, text, supplieritemId, id) values (?, ?, ?, ?, ?, ?)
1237 WARN org.hibernate.util.JDBCExceptionReporter logExceptions [77] - SQL Error: 1110, SQLState: 42000
1237 ERROR org.hibernate.util.JDBCExceptionReporter logExceptions [78] - Column 'supplierItemId' specified twice
org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
at org.hibernate.engine.ActionQueue.executeInserts(ActionQueue.java:132)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:245)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
Name and version of the database you are using:
mysql 5.0.27
Does anyone have an idea why hibernate is trying to insert supplierId twice in the insert statement?