-->
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: Repeated column in mapping for entity
PostPosted: Wed Dec 23, 2009 11:12 pm 
Newbie

Joined: Wed Dec 23, 2009 10:44 pm
Posts: 1
Hi, can anybody help? I got an error when start running the application.
Initial SessionFactory creation failed.org.hibernate.MappingException: Repeated column in mapping for entity: com.hibernate.entities.Item column: seller_id (should be mapped with insert="false" update="false")

My mapping files:
<class name="Item" table="item" lazy="false">
<id name="itemId" column="item_id" type="long">
<generator class="sequence">
<param name="sequence">item_seq</param>
</generator>
</id>
<property name="description" column="description"/>
<property name="initialPrice" column="initial_price"/>
<many-to-one name="seller" column="seller_id" class="Seller" />
</class>

<class name="Seller" table="seller" batch-size="1" >
<id name="sellerId" column="seller_id" type="long">
<generator class="sequence">
<param name="sequence">seller_seq</param>
</generator>
</id>

<property name="name" column="name"/>
<set name="items" cascade="save-update" lazy="false">
<key column="seller_id" not-null="true"/>
<one-to-many class="Item"/>
</set>
</class>

I know that it's because I use not-null="true", so Hibernate requires me to set insert="false" update="false" on the <many-to-one name="seller" column="seller_id" class="Seller" />. But, I would like to know the reason why does Hibernate have to generate the exception for requiring us to set the parameters?


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.