Hibernate version:3
Hi,
I'm using the following statement:
Code:
Criteria crit = getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(DeliveryLineRim.class)
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
.add(Expression.eq("bpCd", data.getBpCd()))
.add(Expression.eq("bpOdsCd", data.getBpOdsCd()))
.setFetchMode("groupTypeCode", FetchMode.JOIN)
.createAlias("groupTypeCode", "groupTypeCode")
.add(Expression.eq("groupTypeCode.grpTyCd", "CUSX1"))
.addOrder(Order.asc("dlvyNo"))
.addOrder(Order.asc("dlvyLiNo"));
These are my mapping files:
Code:
<hibernate-mapping package="de.arvatologistics.rim.model">
<class name="DeliveryLineRim" table="c_d_li_rim_s2">
<composite-id>
<key-property name="dlvyLiNo" type="java.lang.Integer" column="dlvy_li_no" />
<key-property name="dlvyNo" type="java.lang.Integer" column="dlvy_no" />
</composite-id>
<properties name="key">
<property name="BpCd" column="bp_cd" insert="false" update="false" />
<property name="BpOdsCd" column="bp_ods_cd" insert="false" update="false"/>
<property name="CustNb" column="cust_nb" insert="false" update="false"/>
</properties>
<property name="BOReaCd" type="java.lang.String">
<column name="b_o_rea_cd" length="1" />
</property>
<property name="bpCd" type="java.lang.String">
<column name="bp_cd" length="5" />
</property>
<property name="bpCustNb" type="java.lang.String">
<column name="bp_cust_nb" length="15" />
</property>
<property name="bpOdsCd" type="java.lang.String">
<column name="bp_ods_cd" length="5" />
</property>
<property name="catItCd" type="java.lang.String">
<column name="cat_it_cd" length="20" />
</property>
<property name="custNb" type="java.lang.String">
<column name="cust_nb" length="15" />
</property>
<property name="custNm" type="java.lang.String">
<column name="cust_nm" length="30" />
</property>
<property name="debQ" type="java.lang.Integer">
<column name="deb_q" />
</property>
<property name="diffQ" type="java.lang.Integer">
<column name="diff_q" />
</property>
<property name="disFl" type="java.lang.Short">
<column name="dis_fl" />
</property>
<property name="dlvyDt" type="java.util.Date">
<column name="dlvy_dt" length="23" />
</property>
<property name="dlvyNtRmk" type="java.lang.String">
<column name="dlvy_nt_rmk" length="100" />
</property>
<set name="groupTypeCode">
<key property-ref="key" update="false">
<column name="bp_cd"/>
<column name="bp_ods_cd"/>
<column name="cust_nb"/>
</key>
<one-to-many class="GroupTypeCode"/>
</set>
</class>
</hibernate-mapping>
Code:
<hibernate-mapping package="de.arvatologistics.rim.model">
<class name="GroupTypeCode" table="c_c_bp_gr2_v2">
<composite-id>
<key-property name="bpCd" type="java.lang.String">
<column name="bp_cd" length="5" />
</key-property>
<key-property name="bpOdsCd" type="java.lang.String">
<column name="bp_ods_cd" length="5" />
</key-property>
<key-property name="custNb" type="java.lang.String">
<column name="cust_nb" length="15" />
</key-property>
<key-property name="grpCd" type="java.lang.String">
<column name="grp_cd" length="5" />
</key-property>
<key-property name="grpTyCd" type="java.lang.String">
<column name="grp_ty_cd" length="5" />
</key-property>
</composite-id>
<property name="CUid" type="java.lang.String">
<column name="c_uid" length="10" />
</property>
<property name="CDt" type="java.util.Date">
<column name="c_dt" length="23" />
</property>
<property name="UUid" type="java.lang.String">
<column name="u_uid" length="10" />
</property>
<property name="UDt" type="java.util.Date">
<column name="u_dt" length="23" />
</property>
<property name="susyTxCd" type="java.lang.String">
<column name="susy_tx_cd" length="16" />
</property>
<property name="recStat" type="java.lang.Short">
<column name="rec_stat" />
</property>
</class>
</hibernate-mapping>
Unfortunately the groupTypeCode-table will be joined as an inner join. But I need an outer join instead. I thought that FetchMode = JOIN will result in an outer join. Can someone please help me?