-->
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.  [ 2 posts ] 
Author Message
 Post subject: HQL problem
PostPosted: Thu Apr 01, 2004 12:10 am 
Newbie

Joined: Sun Nov 30, 2003 10:09 am
Posts: 14
Hello everybody,
I am a new user of hibernate. It works fine.
But now i m in problem.

I have a class:

SurveyDTO and another class SurveyLineDTO

SurveyDTO contains the collection of SurveyLineDTO.

The attribures of SurveyDTO are
surveyReportImportDate
reportDescription
...........................

and the attribues of SurveyLineDTO are
surveyDate
dirCode
doctorName
teritoryCode
productType
................


Here is my hbm.xml file:

<?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">

<!-- Created by wasim on October 19, 2003, 10:21 AM -->

<hibernate-mapping>

<class name="com.mislbd.iris.marketing.survey.SurveyReportDTO" table="SurveyReport">

<!--<jcs-cache usage="read-write"/>-->

<id column="surveyReportId" name="id">
<generator class="increment"/>
</id>
<property name="surveyReportImportDate"/>
<property name="reportDescription"/>
<many-to-one name="surveyReportResponsible" class="com.mislbd.iris.mis.core.user.UserDTO" column="suveyreportresponsible" not-null="true"/>
<list name="surveyReportLines" table="SurveyReportLine" >
<key column="surveyReportId"/>
<index column="lineItemIndex"/>

<composite-element class="com.mislbd.iris.marketing.survey.SurveyReportLineDTO">

<property name="surveyDate"/>
<property name="dirCode"/>
<property name="doctorName"/>
<property name="auditType"/>
<property name="teritoryCode"/>
<property name="genericProductName"/>
<property name="companyName"/>
<property name="productType"/>
<property name="productStrength"/>
<property name="packType"/>
<property name="packSize"/>
<property name="packSizeUnit"/>
<property name="rxNo"/>
<property name="brand"/>
<property name="posnCode"/>
<property name="quantity"/>
<property name="value"/>
<property name="yearMonth"/>

</composite-element>
</list>

</class>

</hibernate-mapping>

Now i want write a HQL that could retrive the elements of surveyReportLines.

Here is a HQL
select elements(s.surveyReportLines) from SurveyReportDTO s

It gives as element. I need only some property of elements
pls help.
Regards
banik
banik@mislbd.com


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 01, 2004 4:13 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Not sure of me but this should work
Code:
select line.myproperty1, line.myproperty2 from SurveyReportDTO s inner join s.surveyReportLines line

_________________
Emmanuel


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

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.