-->
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: Mapping Hibernate files and relationships - Please help.
PostPosted: Tue Oct 24, 2006 7:26 am 
Newbie

Joined: Wed Oct 04, 2006 5:43 am
Posts: 3
I have two mapping files, and corresponding Java classes.

Mapping files are as follows..

File 1
=====

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 package="myPackage">

<class name="TCMClaimCenterUserCargo"
     table="CC_USER"
    mutable="false">         

   <id name="id"
      type="java.lang.Integer"
      column="ID"
      unsaved-value="null">
        <generator class="assigned"/>
   </id>

   <property name="publicId"       type="java.lang.String"   column="PUBLICID" />
   <property name="officeCode"       type="java.lang.String"   column="LMOFFICECODE" />
   
   
</class>

</hibernate-mapping>


==========
Mapping File 2
==========

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 package="myPackage">

<class name="TCMClaimCenterGroupUserCargo"
     table="CC_GROUPUSER"
    mutable="false">         

   <composite-id>
           <key-property name="groupID"       type="java.lang.Integer"  column="GROUPID" />
           <key-property name="userID"         type="java.lang.Integer"  column="USERID" />          
   </composite-id>   
   
   <property name="textField1"     type="java.lang.String"   column="TEXTFIELD1" />   
   <property name="textField2"       type="java.lang.String"   column="TEXTFIELD2" />
   <property name="textField3"       type="java.lang.String"   column="TEXTFIELD3" />
   <property name="manager"       type="java.lang.String"   column="MANAGER" />
   <property name="member"          type="java.lang.String"   column="MEMBER" />
   
   <property name="loadFactorType" type="java.lang.Integer"  column="LOADFACTORTYPE" />
   <property name="loadHistoryID"  type="java.lang.Integer"  column="LOADHISTORYID" />
   <property name="loadFactor"       type="java.lang.Integer"  column="LOADFACTOR" />

   <!--
   <property name="id"          type="java.lang.Integer"  column="USERID" />
   <property name="groupID"       type="java.lang.Integer"  column="GROUPID" />
   -->
   
   
</class>

</hibernate-mapping>


I need these two files to map to each other so that an inner join is performed. I've tried a few options but I'm not having any luck. The SQL I'm trying to achieve is below...


Select DISTINCT ('0'||(Substr(gr.TEXTFIELD1,1,3))) as OFFICECODE
From DB.CC_GROUPUSER gr
Inner Join DB.CC_USER u on gr.USERID = u.ID
WHERE gr.TEXTFIELD1 IS NOT NULL


Can anyone tell me what I should be doing to get this? I'm totally confused. Both Java files corresponding to the XML have all properties specified in the XML defined in the Java also, along with appropriate getter / setter methods.

Any help is greatly appreciated!!!!


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.