-->
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: Referenced query to same collection element
PostPosted: Wed Aug 10, 2005 1:19 pm 
Beginner
Beginner

Joined: Tue Jun 29, 2004 12:35 pm
Posts: 21
Hibernate version 3:


Greets, I have Query like this:

select aAct.Oid from Act as aAct
where aAct.WfVariableName=?
and aAct.ClassCode=?
and aAct.InboundRelationship.Source=?
and aAct.InboundRelationship.TypeCode=?

Query produces SQL like this:

select act0_.OID as col_0_0_ from Act act0_
inner join ROOT act0_1_ on act0_.OID=act0_1_.OID,
ActRelationship inboundrel1_,
ActRelationship inboundrel2_

where act0_.OID=inboundrel2_.OID_TARGET
and act0_.OID=inboundrel1_.OID_TARGET
and act0_.EXT_WF_ST_VARIABLENAME='pkg1'
and act0_.CS_ST_CLASSCODE='OBSDEF'
and inboundrel1_.OID_SOURCE='998404'
and inboundrel2_.CS_ST_TYPECODE='COMP'


Is it possible using HQL to target InboundRelationship.Source & InboundRelationship.TypeCode to same inboundRelationship element so that produced query will be like this:

select act0_.OID as col_0_0_ from Act act0_
inner join ROOT act0_1_ on act0_.OID=act0_1_.OID,
ActRelationship inboundrel1_
where act0_.OID=inboundrel1_.OID_TARGET
and act0_.EXT_WF_ST_VARIABLENAME='pkg1'
and act0_.CS_ST_CLASSCODE='OBSDEF'
and inboundrel1_.OID_SOURCE='998404'
and inboundrel1_.CS_ST_TYPECODE='COMP'

Thanks


Top
 Profile  
 
 Post subject: Re: Referenced query to same collection element
PostPosted: Wed Aug 10, 2005 1:25 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Try this.

Code:
select aAct.Oid from Act as aAct
inner join aAct.inboundRelationship as inBoundRel
where aAct.wfVariableName=?
   and aAct.classCode=?
   and inBoundRel.source=?
   and inBoundRel.typeCode=?

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


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.