Hello. Whenever I query for a collection, the collection returned would be sized correctly but all elements would all have the value of the first element. In my case, I have a MealOrder that has a bag of SpecialMeals. Whenever I try to get a collection of SpecialMeals, the first element of the resultset repeats on all the elements of the collection. If I am supposed to get 80 SpecialMeals, for example, I'll get 80 all right but the other 79 after the first SpecialMeal in the collection are the same as the first SpecialMeal. I have the mappings and query pertaining to retrieving the collection below.
Mappings:
MealOrder
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="com.air.crew.kitchen.biz.domain.mealorder.MealOrder"
schema="DB2CAT"
table="T_MEAL_ORD">
<composite-id>
<key-property name="airlineCode" column="AL_CDE" type="string"/>
<key-property name="localDepartureDate" column="LCL_DPTR_DTE" type="date"/>
<key-property name="origin" column="MEAL_ORIG_AP_CDE" type="string"/>
<key-property name="flightNumber" column="MEAL_FLT_NUM" type="string"/>
<key-property name="mealOrderCode" column="MEAL_ORD_CDE" type="string"/>
</composite-id>
<property
name="status"
column="MEAL_PRDCT_CDE"
type="string"/>
<!--
<property
name="market"
column="FLT_MKT"
type="character"/>
-->
<component
name="boarding"
class="com.air.crew.kitchen.biz.domain.mealorder.BoardingInformation">
<property
name="flightNumber"
column="MEAL_BRDG_FLT_NUM"
type="string"/>
<property
name="flightDate"
column="MEAL_BRDG_LCL_DTE"
type="date"/>
<property
name="flightTime"
column="MEAL_BRDG_LCL_TME"
type="time"/>
</component>
<component
name="serving"
class="com.air.crew.kitchen.biz.domain.mealorder.ServingInformation">
<!--
<property
name="origin"
column="MEAL_ORIG_AP_CDE"
type="string"/>
-->
<property
name="destination"
column="MEAL_DEST_AP_CDE"
type="string"/>
<!--
<property
name="flightNumber"
column="MEAL_FLT_NUM"
type="string"/>
-->
<property
name="equipment"
column="EQP_TYP_CDE"
type="string"/>
</component>
<component
name="crewMeal"
class="com.air.crew.kitchen.biz.domain.mealorder.CrewMeal">
<property
name="pilotCount"
column="CKPT_CRW_CNT"
type="integer"/>
<property
name="domesticFACount"
column="CBN_CRW_CNT"
type="integer"/>
<!--
<property
name="pacificFACount"
type="short"
column="CBN_CREW_CNT"/>
-->
</component>
<bag name="cabinMeals">
<key>
<column name="AL_CDE"/>
<column name="LCL_DPTR_DTE"/>
<column name="MEAL_ORIG_AP_CDE"/>
<column name="MEAL_FLT_NUM"/>
<column name="CBN_CL_CDE"/>
</key>
<one-to-many class="com.air.crew.kitchen.biz.domain.mealorder.CabinMeals"/>
</bag>
<bag name="specialMeals">
<key>
<column name="AL_CDE"/>
<column name="LCL_DPTR_DTE"/>
<column name="MEAL_ORIG_AP_CDE"/>
<column name="MEAL_FLT_NUM"/>
<column name="CBN_CL_CDE"/>
</key>
<one-to-many class="com.air.crew.kitchen.biz.domain.mealorder.SpecialMeals"/>
</bag>
</class>
</hibernate-mapping>
SpecialMeals
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.air.crew.kitchen.biz.domain.mealorder.SpecialMeals"
schema="DB2CAT"
table="T_CBN_SPEC_MEAL">
<composite-id>
<key-property name="airlineCode" column="AL_CDE" type="string"/>
<key-property name="localDepartureDate" column="LCL_DPTR_DTE" type="date"/>
<key-property name="originAPCode" column="MEAL_ORIG_AP_CDE" type="string"/>
<key-property name="flightNumber" column="MEAL_FLT_NUM" type="string"/>
<key-property name="cabinClassCode" column="CBN_CL_CDE" type="string"/>
</composite-id>
<property
name="mealCode"
column="SPEC_MEAL_CDE"
type="string"/>
<property
name="mealCount"
column="SPEC_MEAL_CNT"
type="integer"/>
<property
name="mealDesc"
column="SPEC_MEAL_DESC"
type="string"/>
</class>
</hibernate-mapping>
The query retrieving the SpecialMeals collection
Code:
select specialmea0_.AL_CDE as AL1_1_, specialmea0_.LCL_DPTR_DTE as LCL2_1_, specialmea0_.MEAL_ORIG_AP_CDE as MEAL3_1_, specialmea0_.MEAL_FLT_NUM as MEAL4_1_, specialmea0_.CBN_CL_CDE as CBN5_1_, specialmea0_.AL_CDE as AL1_3_0_, specialmea0_.LCL_DPTR_DTE as LCL2_3_0_, specialmea0_.MEAL_ORIG_AP_CDE as MEAL3_3_0_, specialmea0_.MEAL_FLT_NUM as MEAL4_3_0_, specialmea0_.CBN_CL_CDE as CBN5_3_0_, specialmea0_.SPEC_MEAL_CDE as SPEC6_3_0_, specialmea0_.SPEC_MEAL_CNT as SPEC7_3_0_, specialmea0_.SPEC_MEAL_DESC as SPEC8_3_0_ from DB2CAT.T_CBN_SPEC_MEAL specialmea0_ where specialmea0_.AL_CDE=? and specialmea0_.LCL_DPTR_DTE=? and specialmea0_.MEAL_ORIG_AP_CDE=? and specialmea0_.MEAL_FLT_NUM=? and specialmea0_.CBN_CL_CDE=?