-->
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: Possible Bug
PostPosted: Mon May 19, 2008 8:58 am 
Newbie

Joined: Wed May 14, 2008 5:58 am
Posts: 4
I performed an HQL query and I think it may reveal a bug - feedback is welcome. I am in an environment which uses Oracle9Dialect and an Oracle 10.2 database.

The tables are (sanitized):

ORDERS
====
ID (primary key)

PRODUCTS
=====
ID (primary key)
ORDERID (foreign key)

The classes contain:

Order
=================
+ID
+products (one-to-many)

Product
=================
+ID
+order (many-to-one)

The HQL query was:

from Product p WHERE p in(select theOrder.products from Order theOrder where theOrder.Id = 123) AND rownum = 1

This should return one result. (The internal WHERE clause has a purpose in the actual application, in this example it makes rownum pointless).


The SQL produced was:

select product0_.Id as Id7_ from PRODUCTS product0_
WHERE
(product0_.Id in
(select . from ORDERS order1_,
PRODUCTS product2_
where order1_.Id=product2_.ORDERID and order1_.Id=-164001)) and rownum=1


The problem is "SELECT . ", and the query fails. If it had produced "SELECT product2_.Id" it would have worked.

Cheers!


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.