Hello,
I have a old shema database. Each table have a composite-id. there is a relation many-to-many
between 2 tables (C_OFFOPTTIT et C_TARIFS). Hibernate delete all data in the linked table when I load a table. what can
i do to resolve my problem.
Leto
List listOffOptTit = baseDAOHibernate.getHibernateTemplate().find("from OffOptTit");
Hibernate version :2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping > <class name="com.presseinfo.netful.connector.model.referential.OffOptTit" table="C_OFFOPTTIT" dynamic-update="false" dynamic-insert="false" select-before-update="false" optimistic-lock="version" > <cache usage="read-write"/> <composite-id >
<key-property name="codeSoc" type="java.lang.String" column="OTICODSOC" /> <key-property name="codeTit" type="java.lang.String" column="OTICODTIT" /> <key-property name="codeOffre" type="java.lang.String" column="OTICODOFF" /> <key-property name="codeOption" type="java.lang.String" column="OTIOPT" /> <key-property name="cdSoc" type="java.lang.String" column="OTISOCOPT" /> <key-property name="cdtit" type="java.lang.String" column="OTITITOPT" /> <key-property name="sequenceInstallation" type="java.lang.Long" column="OTISEQTIT" /> </composite-id> <set name="tarifs" table="lnk_offoptit_tarif" lazy="false" inverse="false" cascade="none" sort="unsorted" >
<key foreign-key="FK_OFFOPTTIT_TARIF" > <column name="OTICODSOC"/> <column name="OTICODTIT"/> <column name="OTICODOFF"/> <column name="OTIOPT"/> <column name="OTISOCOPT"/> <column name="OTITITOPT"/> <column name="OTISEQTIT"/> </key>
<many-to-many class="com.presseinfo.netful.connector.model.referential.Tarif" outer-join="auto" foreign-key="FK_TARIF_OFFOPTTIT" > <column name="TARCODSOC"/> <column name="TARCODTIT"/> <column name="TARCODTAR"/> <column name="TARDATDEB"/> <column name="TARDATFIN"/> </many-to-many> </set>
<set name="acheminements" table="lnk_offoptit_acheminement" lazy="true" inverse="false" cascade="none" sort="unsorted" >
<key foreign-key="FK_OFFOPTTIT_ACHEMINEMENT" > <column name="OTICODSOC"/> <column name="OTICODTIT"/> <column name="OTICODOFF"/> <column name="OTIOPT"/> <column name="OTISOCOPT"/> <column name="OTITITOPT"/> <column name="OTISEQTIT"/> </key>
<many-to-many class="com.presseinfo.netful.connector.model.referential.Acheminement" outer-join="auto" foreign-key="FK_ACHEMINEMENT_OFFOPTTIT" > <column name="ACHCODSOC"/> <column name="ACHCODTIT"/> <column name="ACHCODACH"/> <column name="ACHDATDEB"/> <column name="ACHZAFPAY"/> <column name="ACHCODEXP"/> </many-to-many> </set>
<property name="codeAcheminement" type="java.lang.String" update="true" insert="true" access="property" column="OTICODACH" length="6" /> <!-- <property name="codeTarif" type="java.lang.String" update="true" insert="true" access="property" column="OTICODTAR" length="2" /> --> <property name="codeCouplage" type="java.lang.String" update="true" insert="true" access="property" column="OTICODCPL" length="1" />
<property name="codeReglement" type="java.lang.String" update="true" insert="true" access="property" column="OTICODRGT" length="4" />
<property name="topExpeditionAvion" type="java.lang.String" update="true" insert="true" access="property" column="OTIAVINOR" length="1" />
<property name="topExpeditionAvionRecommande" type="java.lang.String" update="true" insert="true" access="property" column="OTIAVIREC" length="1" />
<property name="topExpeditionSurface" type="java.lang.String" update="true" insert="true" access="property" column="OTISURNOR" length="1" />
<property name="topExpeditionSurfaceRecommande" type="java.lang.String" update="true" insert="true" access="property" column="OTISURREC" length="1" />
<!-- To add non XDoclet property mappings, create a file named hibernate-properties-OffOptTit.xml containing the additional properties and place it in your merge dir. -->
</class>
</hibernate-mapping>
************************************* ************************************* <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping > <class name="com.presseinfo.netful.connector.model.referential.Tarif" table="C_TARIFS" dynamic-update="false" dynamic-insert="false" select-before-update="false" optimistic-lock="version" > <cache usage="read-write"/> <composite-id > <key-property name="codeSoc" column="TARCODSOC" type="java.lang.String" length="2" /> <key-property name="codeTit" column="TARCODTIT" type="java.lang.String" length="2" /> <key-property name="code" column="TARCODTAR" type="java.lang.String" length="2" /> <key-property name="dateDeb" type="java.util.Date" column="TARDATDEB" /> <key-property name="dateFin" type="java.util.Date" column="TARDATFIN" /> </composite-id>
<property name="duree" type="java.lang.Long" update="true" insert="true" access="property" column="TARDUR" />
<property name="libelle" type="java.lang.String" update="true" insert="true" access="property" column="TARLIBTAR" />
<property name="montantTTC" type="java.lang.Double" update="true" insert="true" access="property" column="TARMNTHT" />
<property name="montantHT" type="java.lang.Double" update="true" insert="true" access="property" column="TARMNTTTC" />
<property name="topActivite" type="java.lang.String" update="true" insert="true" access="property" column="TARACTTAR" length="1" />
<!-- To add non XDoclet property mappings, create a file named hibernate-properties-Tarif.xml containing the additional properties and place it in your merge dir. -->
</class>
</hibernate-mapping>
List listOffOptTit = baseDAOHibernate.getHibernateTemplate().find("from OffOptTit");
|