I have some trouble with the .class keywork.
1 - The following request works fine :
[HQL]
Code:
select item from Item item where item.class = CD and item.Tracks.size > 2
[Generated SQL]
Code:
select item0_.ID as ID0_,
item0_.NAME as NAME0_,
item0_.STATUS as STATUS0_,
item0_.TYPE as TYPE0_,
item0_.CA TEGORYID as CATEGORYID0_,
item0_.BUYERID as BUYERID0_,
item0_2_.SUMMARY as SUMMARY3_,
decode(item0_.ID, item0_1_.ID, 1, item0_2_.ID, 2, 0) as clazz_
from ITEMS item0_, CDS item0_1_, BOOKS item0_2_
where item0_.ID = item0_1_.ID(+)
and item0_. ID = item0_2_.ID(+)
and ((decode(item0_.ID, item0_1_.ID, 1, item0_2_.ID, 2, 0) = 1) and
((select count(*)
from TRACKS tracks 1_
where item0_.ID = tracks1_.CDID) > 2))
2 - The following request doesn't work fine :
[HQL]
Code:
select user from User user left outer join user.Bids bid where bid.Item.class = Book and length(bid.Item.Summary) < 50
[Generated SQL]
Code:
select user0_.ID as ID6_,
user0_.FIRSTNAME as FIRSTNAME6_,
user0_.LASTNAME as LASTNAME6_,
user0_.AGE as AGE6_,
user0_.STREET as STREET6_,
user0_.CITY as CITY6_,
user0_.ZIPCODE as ZIPCODE6_,
user0_.COUNTRY as COUNTRY6_,
user0_.USERLEVEL as USERLEVEL6_,
user0_.TYPE as TYPE
from USERS user0_, BIDS bids1_, ITEMS item2_
where user0_.ID = bids1_.USERID(+)
and ((decode(item2_.ID, item2_1_.ID, 1, item2_2_.ID, 2, 0) = 2 and
bids1_.ITEMID = item2_.ID) and
(length(item2_2_.SUMMARY) < 50 and bids1_.ITEMID = item2_.ID))
Does anyone know how to solve this ?
Thanks in advance.