-->
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 for composite element with multi column property
PostPosted: Wed Jul 09, 2008 10:50 am 
Newbie

Joined: Wed Jul 09, 2008 10:20 am
Posts: 1
Hi, I am using Hibernate 3.2.5 and need some help to resolve this issue.

I have following mapping (showing part of it for sake of brevity)


Code:
<class name="xyz.Case" table="CASE" dynamic-update="true" dynamic-insert="true">
      <id name="id" type="CaseIDUserType" column="ID">
         <generator class="assigned" />
      </id>
.
.
.
.
<bag name="documents" cascade="all" lazy="true" table="DOCUMENT">
         <key column="CASE_ID" />
         <composite-element class="xyz.Document">
            <property name="caseDocument" type="DocumentUserType">
               <column name="DOC_ID" not-null="true"/>
               <column name="DOC_VERSION_ID" not-null="false"/>
            </property>
         </composite-element>
      </bag>



I am using following hql to fetch cases based on document's id and ignoring doc_version_id

Code:
select case
      from Case case
      join case.documents as document
      where document.caseDocument.id = :documentId


but this is resulting in sql like

select * from case c inner join Document d on c.id = d.case_id where d.id = ?

while I was expecting

select * from case c inner join Document d on c.id = d.case_id where d.doc_id = ?


Could anybody guide me what I am doing wrong? Is this even possible using hql?

Any help is highly 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.