I've read about the lack of support for subquerys with HQL, but anyway, anyone could tell me if this SQL query could be implemented with HQL?
I've already made some testing but with no success...don't know if I'm in the right path...
SQL (working)
Code:
SELECT
foo.id as fooId,
foo.name AS fooName,
chan.name AS chanName,
(SELECT DISTINCT
foo_lang.VALUE
FROM
foo_lang
WHERE
foo_lang.foo_id = fooId AND
foo_lang.lang_id = 1) as EN
FROM
foo
INNER JOIN chan ON foo.chan_id = chan.id
HQL (not working)
Code:
select new
Map(o.id as id,
o.name as fooName,
c.name as chanName,
(select fl.value from foo_lang fl where fl.id.fId = id and fl.id.lId = 1) as EN)
from
foo o
left join o.chan c
It gives:
org.hibernate.TypeMismatchException: left and right hand sides of a binary logic operator were incompatibile [big_decimal : component[lId,rId]]
Is about the subquerys or something else?
Thanks in advance.