-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Components and many-ton-one
PostPosted: Sun Sep 21, 2008 12:15 am 
Newbie

Joined: Sat Sep 20, 2008 11:36 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.