Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Issues List »

[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3363) Invalid
SQL: missing join and column

Anupam M (JIRA)

2008-06-30


Author LoginPost Reply
Invalid SQL: missing join and column
------------------------------------

          Key: HHH-3363
          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3363
        Project: Hibernate3
      Issue Type: Bug
  Affects Versions: 3.3.0.CR1, 3.2.6
     Environment: hsqldb
       Reporter: Istvan Kovacs


Using the same sources as in HHH-3362

select p.name, s.name, s.stock[p]
from Shop s, Product p

This produces SQL that does not contain the stock column, and does not
join tables PRODUCT and SHOP via SHOP_PRODUCT_STOCK:
select
product1_.name as col_0_0_,
shop0_.name as col_1_0_
from
Shop shop0_,
PRODUCT product1_

In another query, the join is performed when stock[p] is referenced:
select emp.name, shop.name
from
    Employee emp join emp.shop as shop, Product p
where
    shop.stock[p] > 5
    and
    p.name='Product_10'

SQL:
select
employee0_.name as col_0_0_,
shop1_.name as col_1_0_
from
Employee employee0_
inner join
Shop shop1_
 on employee0_.SHOP_ID=shop1_.SHOP_ID,
PRODUCT product2_,
SHOP_PRODUCT_STOCK stock3_
where
shop1_.SHOP_ID=stock3_.SHOP_ID
and stock3_.PRODUCT_ID = product2_.PRODUCT_ID
and stock3_.AMOUNT>5
and product2_.name='Product_10'

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

   
_______________________________________________
hibernate-issues mailing list
hibernate-issues@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-issues
©2008 gg3721.com - Jax Systems, LLC, U.S.A.