Àh I see what you mean.
The problem is that you're expecting a query for java objects to return database rows (converted to java objects). That is, you want a "bit of" the Eiendom objects: you want to exclude some of their kvotes. You need a different query for that.
Your options are:
1) Get the kvotes seperately:
Code:
select e, k
FROM Eiendom e
join e.kvotes k
where e.komnr ='0438'
and e.gardsnr =11
and e.bruksnr =47
and k.aktiv =1
This query will return a list of Object[2]s, so code like this would be required to get at the contents:
Code:
for (Object[] ret : qry.list())
{
Eiendom e = (Eiendom) ret[0];
Kvote k = (Kvote) ret[1];
// Do stuff with objects
}
What you're actually interested in are the Kvotes, and this query returns the correct ones, paired with the Eiendoms that hold them.
2) Just get the Kvotes, if Kvotes has a link back to Eiendom:
Code:
select k
FROM Eiendom e
join e.kvotes k
where e.komnr ='0438'
and e.gardsnr =11
and e.bruksnr =47
and k.aktiv =1
3) Switch to Criteria and use the ROOT_ALIAS transformer. Though that's basically the same as option 1, just using Criteria instead of HQL.