-->
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: By using Criteria or HQL can we do this ?
PostPosted: Wed Dec 21, 2005 6:42 am 
Newbie

Joined: Mon Jul 25, 2005 7:38 am
Posts: 6
Location: Hyderabad
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3
Mapping documents:
PartyAddress :
<class name="com.model.party.PartyAddress" table="PARTY_ADDRESS" >

<id name="partyAddressId" column="UNIQUE_PARTY_ADDRESS_ID">
<generator class="sequence" >
<param name="sequence">PARTY_ADDRESS_ID_SEQ</param>
</generator>
</id>

<property name="forUseOf" type="string">
<column name="ADDRESS_USE" sql-type="VARCHAR2"/>
</property>
<property name="addressId" column="ADDRESS_ID"/>

<many-to-one name="party" class="com.model.party.hibernate.Party"
column="PARTY_ID" insert="false" update="false" lazy="false" fetch="join" />
<many-to-one name="address" class="com.model.party.hibernate.NewAddress"
column="ADDRESS_ID" insert="false" update="false" lazy="false" fetch="join"/>
</class>

Address :
<class proxy="com.model.party.AddressIntf"
name="com.model.party.hibernate.NewAddress" table="ADDRESS" lazy="false">
<id name="addressId" column="ADDRESS_ID">
<generator class="sequence">
<param name="sequence">PARTY_ADDRESS_ID_SEQ</param>
</generator>
</id>


<property name="addressType" type="string">
<column name="ADDRESS_TYPE" sql-type="VARCHAR2"/>
</property>

<joined-subclass proxy="com.model.party.GeographicAddressIntf"
name="com.model.party.hibernate.GeographicAddress" lazy="false" table="GEOGRAPHIC_ADDRESS">
<key column="ADDRESS_ID"/>
<property name="addressLine1" column="LINE_1"/>
<property name="addressLine2" column="LINE_2"/>
<property name="state" column="STATE"/>
<property name="city" column="CITY"/>
<property name="zipCode" column="ZIP_1"/>
</joined-subclass>

<joined-subclass proxy="com.model.party.TelecomAddressIntf"
name="com.model.party.hibernate.NewTelecomAddress" lazy="false" table="TELECOM_ADDRESS">
<key column="ADDRESS_ID"/>
<!-- <property name="phoneNumber" column="PHONE"/> -->
<property name="phoneNumber" type="long">
<column name="PHONE" sql-type="number"/>
</property>
<property name="areaCode" column="AREA_CODE"/>
<property name="countryCode" column="COUNTRY_CODE"/>

<!-- <component name="phone" class="com.model.PhoneNumber">
<property name="phoneNumber" column="PHONE"/>
<property name="phoneNumber" type="long">
<column name="PHONE" sql-type="number"/>
</property>
<property name="areaCode" column="AREA_CODE"/>
<property name="countryCode" column="COUNTRY_CODE"/>
</component>
-->
</joined-subclass>




Code between sessionFactory.openSession() and session.close():
NA
Full stack trace of any exception that occurs:
NA
Name and version of the database you are using:
Oracle 9
The generated SQL (show_sql=true):
NA
Debug level Hibernate log excerpt:
NA

Iam trying to reproduct the same effect produced by the following SQL :

SELECT pa.*
FROM party_address pa, geographic_address ga, telecom_address ta
WHERE pa.address_id IN (ga.address_id, ta.address_id)
AND pa.party_id = '4200000'
AND pa.address_id = ga.address_id(+)
AND pa.address_id = ta.address_id(+)

I have the mappings working perfectly for all the classes PartyAddress,GeographicAddress and TelecomAddress .

I want to get both the addresses Geographic and Telecom for Party .

Above mappings I think are correct. Please let me know if there is any changes required.

Any help is helpful.
Thanks

_________________
HiberNATE


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.