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.  [ 4 posts ] 
Author Message
 Post subject: outer or full join must be followed by path expression
PostPosted: Wed Dec 07, 2005 10:36 pm 
Regular
Regular

Joined: Mon May 30, 2005 11:20 pm
Posts: 66
Hey I'm really clueless on the exception....

outer or full join must be followed by path expression

Can anyone tells me what's wrong with this HQL query?

FROM warehouse.to.InvRequest AS INVREQ
WHERE INVREQ.RequestID IN
(
SELECT INVREQITEM.ParentInvRequest.RequestID
FROM warehouse.to.inv_request_item AS INVREQITEM
WHERE
INVREQITEM.ParentInvRequest.RequestID=INVREQ.RequestID
AND
(
INVREQITEM.StatusID=5 OR INVREQITEM.StatusID=12
)
)

AND

(
INVREQ.RequestID IN
(
SELECT REQ1.RequestID FROM warehouse.to.InvRequest REQ1
JOIN warehouse.to.inv_request_item INVREQITEM1 WHERE REQ1.RequestID<1000

)
)


You see, the problem is with the highlighted JOIN statement - I removed it and the problem goes away.

NOTE: RequestID < 1000 criteria may look trivial - I simplify this for the sake of troubleshooting.


Last edited by nfung on Thu Dec 08, 2005 3:41 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Joining two unrelated tables?
PostPosted: Wed Dec 07, 2005 11:46 pm 
Regular
Regular

Joined: Mon May 30, 2005 11:20 pm
Posts: 66
For those of you who're suspecting it has to do with mapping files...

Mapping file for "Inventory Request" (parent of "Inventory Request Item")
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="warehouse.to.InvRequest, WarehouseLib" table="inv_request">

<id name="RequestID" column="request_id" type="Int32" unsaved-value="0" >
<generator class="identity" />
</id>

<property name="RequestedBy" column="requested_by" type="Int32" />
<property name="DeliverTo" column="deliver_to" type="String" length="100" />
<property name="DeliverDate" column="deliver_date" type="DateTime" />
<property name="InvAdjust" column="inv_adjust" type="Boolean" />
<property name="Remarks" column="remarks" type="String" length="2147483647" />

<property name="CreateBy" column= "CreateBy" type="Int32"/>
<property name="CreateDate" column= "CreateDate" type="DateTime"/>
<property name="OwnerGroup" column= "OwnerGroupUIN" type="Int32"/>
<property name="LastUpdateBy" column= "LastUpdateBy" type="Int32"/>
<property name="LastUpdateDate" column= "LastUpdateDate" type="DateTime"/>

<set name="RequestItems" inverse="true" cascade="all" table="inv_request_item" lazy="false">
<key column="request_id"/>
<one-to-many class="warehouse.to.inv_request_item, WarehouseLib"/>
</set>


</class>
</hibernate-mapping>


And that for the child "Inventory Request Item" (table: inv_request_item) is as follows:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="warehouse.to.inv_request_item, WarehouseLib" table="inv_request_item">

<composite-id unsaved-value="none" >
<key-many-to-one name="ParentInvRequest" column="request_id" class="warehouse.to.InvRequest, WarehouseLib" />
<key-property name="ItemID" column= "item_id" type="Int32" />
</composite-id>

<property name="RequestedQty" column= "requested_qty" type="Decimal" />
<property name="RevisedQty" column="revised_qty" type="Decimal" />
<property name="ConfirmedQty" column= "confirmed_qty" type="Decimal" />
<property name="StatusID" column= "status_id" type="Int16" />
<property name="Remarks" column= "remarks" type="String" length="100" />

<property name="CreateBy" column= "CreateBy" type="Int32"/>
<property name="CreateDate" column= "CreateDate" type="DateTime"/>
<property name="LastUpdateBy" column= "LastUpdateBy" type="Int32"/>
<property name="LastUpdateDate" column= "LastUpdateDate" type="DateTime"/>
</class>
</hibernate-mapping>


Last edited by nfung on Thu Dec 08, 2005 2:52 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 08, 2005 6:08 am 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
Code:
SELECT REQ1.RequestID FROM warehouse.to.InvRequest REQ1
JOIN warehouse.to.inv_request_item INVREQITEM1 WHERE REQ1.RequestID<1000


the joined class should be specified by its collection "path" from the parent class, something like this:

Code:
SELECT REQ1.RequestID FROM warehouse.to.InvRequest REQ1
JOIN REQ1.RequestItems INVREQITEM1 WHERE REQ1.RequestID<1000


Please have look to the Hibernate documentation regarding HQL.

cheers,
Radu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 08, 2005 6:11 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
In HQL you cannot do arbitrary joins, only joins following an association property, so you have to write something like
Code:
...FROM InvRequest REQ1 JOIN REQ1.RequestItems INVREQITEM1...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.