Hi,
I am working with ssimple parent /child relationship and i am getting the following exception
org.hibernate.MappingException: Repeated column in mapping for entity:
OrderPermitUnitDetail column: OrderNumber (should be
mapped with insert="false" update="false")
I am using the following code.
Mapping file for Parent Class: OrderPermit
<set
name="orderPermitUnitDetails"
lazy="false"
inverse="false"
cascade="all"
>
<key>
<column name="orderNumber" />
</key>
<one-to-many
/>
</set>
Mapping file for Child class :
<class
name="OrderPermitUnitDetail" table="orderpermitunitdetail">
<composite-id name="comp_id" class="OrderPermitUnitDetailPK">
<key-property
name="orderNumber"
column="OrderNumber"
type="java.lang.Integer"
length="11"
/>
<key-property
name="tbilotNumber"
column="TBILotNumber"
type="java.lang.String"
length="20"
/>
</composite-id>
<many-to-one
name="orderPermitDTO"
class="OrderPermitDTO"
not-null="true"
column="OrderNumber"
cascade="none"
outer-join="auto"
/>
and in Client program I am calling like this:
orderPermitDTO.setFoundationsystem("PA");
orderPermitDTO.setFoundationwallheight("PA");
orderPermitDTO.setAttachedBuildingNumber("25011");
orderPermitDTO.setPermitSetType("Lot");
orderPermitDTO.setVendorEmailAddresses("xy@yahoo.com");
orderPermitDTO.setOrderNumber(new Integer(1001));
OrderPermitUnitDetailPK orderPermitUnitDetailPK =
new OrderPermitUnitDetailPK(new Integer(1001),"ab");
OrderPermitUnitDetail orderPermitUnitDetail
= new OrderPermitUnitDetail(orderPermitUnitDetailPK, "Nagesh", "Nag",
"test", "250", "junk", "done");
Set orderPermitUnitDetails = new HashSet();
orderPermitUnitDetail.setOrderPermitDTO(orderPermitDTO);
orderPermitUnitDetails.add(orderPermitUnitDetail);
Any help is appreciated.
Regards
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: