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?
|