-->
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: java.sql.SQLException: Column 'FIELDID' specified twice
PostPosted: Sat Nov 11, 2006 3:41 pm 
Beginner
Beginner

Joined: Tue Feb 08, 2005 1:29 pm
Posts: 20
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


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.