Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: v3
Mapping documents:
<hibernate-mapping package="com.etil.sudetp.business.manager.gameaccount.impl" >
<class name="Account" table="account" >
<cache usage="nonstrict-read-write"/>
<id name="accountId" unsaved-value="null" column="ACCOUNTID" >
<generator class="assigned"/>
</id>
<property name="timestampDB" type="long" column="TIMESTAMP" />
<property name="date" type="java.util.Date" column="DATE" />
<property name="description" type="string" column="DESCRIPTION" />
<property name="gameId" type="int" column="GAMEID" />
<property name="serverId" type="int" column="SERVERID" />
<map name="accountFieldMap" table="ACCOUNTFIELDMAP" cascade="all">
<key column="id" not-null="true"/>
<map-key column="fieldId" type="string"/>
<one-to-many class="AccountField"/>
</map>
</class>
</hibernate-mapping>
<hibernate-mapping package="com.etil.sudetp.business.manager.gameaccount.impl" >
<class name="AccountField" table="accountfieldmap" >
<id name="id" type="int" column="ID" >
<generator class="native"/>
</id>
<property name="accountId" type="string" column="ACCOUNTID" />
<property name="fieldId" type="string" column="FIELDID" />
<property name="status" type="string" column="STATUS" />
<property name="value" type="string" column="VALUE" />
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
2006-11-11 19:21:34,153 172108 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not insert: [com.etil.sudetp.business.manager.gameaccount.impl.AccountField] [insert into accountfieldmap (ACCOUNTID, FIELDID, STATUS, VALUE, id, fieldId) values (?, ?, ?, ?, ?, ?)]
java.sql.SQLException: Column 'FIELDID' specified twice
Name and version of the database you are using:
MySQL 4.1
Problem:
My class Account has a java Map for the list of AccountField objects, the key of the Map is fieldId.
When I am persisting an Account, the Map of AccountFields is persisted too generating the exception of double fieldId.
Any idea why I am facing that problem?
Thanks.
DvJ