I have the following tables:
CREATE TABLE `TRANSACTION_TBL` (
`TRANSACTION_ID` varchar(50) NOT NULL,
`DLR_CODE` int(11) default NULL,
`MBLOX_CODE` int(11) default NULL
)
CREATE TABLE `MPTT` (
`CODE` INT NOT NULL,
`INDICATION` VARCHAR(20),
`STATUS_DESC` VARCHAR(10),
`REASON_DESC` VARCHAR(50),
`EXPLANATION` VARCHAR(250),
PRIMARY KEY (`CODE`)
)
The transaction table has a foreign key relationship to mptt table with the MBLOX_CODE column. To make my code cleaner, and more understandable, I created a "delivery report" class named Dlr which has the the DLR_CODE and MBLOX_CODE. The transaction table has a Dlr class. And the Dlr class has a Mptt class. However, I'm not able establish the map between transaction and mptt. I thought I could use the component to map the Dlr class along wit the Mptt class. Below is the mapping xml file:
<hibernate-mapping>
<class name="com.upmobile.midccore.domain.Transaction" table="TRANSACTION_TBL">
<id name="id">
<generator class="uuid.hex" />
</id>
...
<component name="dlr" class="com.upmobile.midccore.domain.Dlr">
<property name="status" column="DLR_CODE"/>
<many-to-one name="mptt" column="MBLOX_CODE" class="com.upmobile.midccore.domain.Mptt"/>
</component>
</class>
</hibernate-mapping>
//Mapping for the mptt
<hibernate-mapping>
<class name="com.upmobile.midccore.domain.Mptt" table="MPTT">
<id name="code" access="field">
<generator class="increment" />
</id>
<property name="indication" access="field" column="INDICATION" update="false"/>
<property name="statusDesc" column="STATUS_DESC" update="false"/>
<property name="reasonDesc" column="REASON_DESC" update="false"/>
<property name="explanation" column="EXPLANATION" update="false"/>
</class>
</hibernate-mapping>
I have data in the mptt table but when I try to establish the join, nothing comes up other than the MBLOX_CODE that I pass.
I appreciate the help.
_________________ Marcelo
|