-->
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: How can search on an element of a component collection?
PostPosted: Tue Jan 04, 2005 1:43 pm 
Newbie

Joined: Thu Dec 30, 2004 7:44 am
Posts: 15
Greetings,

I have a question on how I can construct a HQL query to search for an item. I have 2 main classes of interest. The SubscriptionInfo class contains a list of SubscriptionStatus objects. In these objects I have a reference to the subscription and the sequence number (the latest issue that the user has obtained).

What I want to do is find a SubscriptionStatus for the user X where the subscription is Y. I cant figure out how to build a HQL to do that.

For your reference, the mapping is provided here.

Thanks in advance.

-- Robert

Hibernate version:
Current production (NOT the beta)

Mapping documents:
Code:
<?xml version="1.0" encoding='utf-8'?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
  "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping schema="CandiedServices"
   package="com.bmw.candy.candiedServices.data">

   <class name="Subscription" table="SUBSCRIPTION">
      <id name="ID" type="long" unsaved-value="null" column="ID">
         <generator class="native" />
      </id>
      <property name="name" length="16" not-null="true" />
      <property name="description" length="256" not-null="true" />
      <property name="sequenceNum" />
      <list name="items" table="SUBSCRIPTION_ITEMS" lazy="true">
         <key column="_itemID" />
         <index column="_position"/>
         <element type="string" length="1024" not-null="true" />
      </list>
   </class>

   <class name="SubscriberInfo" table="SUBSCRIBER_INFO" lazy="true">
      <id name="ID" type="long" unsaved-value="null" column="ID">
         <generator class="native" />
      </id>
      <property name="username" length="15" not-null="true" />
      <property name="password" length="30" not-null="true" />
      <property name="familyName" length="30" not-null="true" />
      <property name="givenName" length="30" not-null="true" />
      <set name="subscriptions" table="SUBSCRIBER_SUBSCRIPTIONS">
         <key column="_statusID" />
         <composite-element class="SubscriptionStatus">
            <property name="lastSequenceNumber" />
            <many-to-one name="subscription"/>
         </composite-element>
      </set>
   </class>

</hibernate-mapping>


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.