tags:

views:

76

answers:

1

Hi,

i have SQL query , i dont know how to write in hibernate

select lp.lnprdtname,la.lid,la.step 
from mfic.lnapp as la 
left join mfic.lnprdt as lp on lp.lnprdtid in 
    (select lnprdtid from mfic.lnapp where lid in 
        (select lid from mfic.lnbrwr where brwrid in 
            (select brwrid from mfic.brwr where uid=1)))
where la.lid in 
    (select lid from mfic.lnbrwr where brwrid in 
        (select brwrid from mfic.brwr where uid=1));

thanks for advance

A: 

As said here: Chapter 14. HQL: The Hibernate Query Language - 14.13. Subqueries

from DomesticCat as cat
where cat.name not in (
    select name.nickName from Name as name
)

Note that HQL subqueries can occur only in the select or where clauses.

Anyway, I'm not sure it's a good idea to concat so many subqueries in a single statement...

Tomas Narros
ok thanks, any other idea?
Ganesamoorthy
Yes, I would try to write these subquieres in a database view, and make the Hibernate access easier.
Tomas Narros