-->
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: HQL on many-to-many association
PostPosted: Thu Apr 14, 2005 2:59 pm 
Newbie

Joined: Mon Sep 27, 2004 6:52 pm
Posts: 6
Location: US
I am trying to model a many-to-many relationship with a composite element and a many-to-one tag.
I was not able to frame the HQL to do the same. Any help is highly appreciated.

Hibernate version: 3.0

Mapping documents:
The mapping for Tour:
<?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="com.princess.web.bean">
<class name="Tour" table="TOUR">
<id name="resTourId" type="string">
<column name="res_tour_id"/>
<generator class="uuid.hex"/>
</id>
<set name="tourDeparture" table="tour_departure">
<key column="res_tour_id" />
<composite-element class="com.princess.web.bean.TourDeparture">
<property name="resDepartDate" column="res_depart_date" type="date" />
<property name="resArriveDate" column="res_arrive_date" type="date" />
<many-to-one name="resVoyageId" column="res_voyage_id" class="com.princess.web.bean.Voyage" />
</composite-element>
</set>

<property name="resDescription" column="res_description" type="string" />
</class>
</hibernate-mapping>


The mapping for Voyage:
<?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="com.princess.web.bean">
<class name="Voyage" table="VOYAGE">
<id name="resVoyageId" type="string">
<column name="res_voyage_id"/>
<generator class="uuid.hex"/>
</id>
<property name="resShipId" column="res_ship_id" type="string" />
</class>
</hibernate-mapping>

TourDeparture is the association table of Tour and Voyage, containing the following fields:
res_tour_id <fk>
res_voyage_id <fk>
res_depart_date
res_Arrive_date



can anyone help me in framing the HQL for
list of all tour for ships with resShipId="XX"?
Please note that resShipId is a field in Voyage.


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.