Hibernate version: 3.1.2
Name and version of the database you are using: Oracle 9.2
Hi,
I am executing a hql query that has a couple of subselects, and an order by clause. It is to search a database for people with a firstname, city, and email criteria. For some reason the generated sql has missing criteria after the email subselect.
Here is the HQL:
select
party from Party party
where
party.urn in
(
select
party.urn
from
Party party,
Contactpointmap contactpointmap,
Contactpoint contactpoint
where
party.urn=contactpointmap.party.urn and
contactpointmap.contactpoint.contactpointurn=contactpoint.contactpointurn and
lower(contactpoint.electronicaddress) like '%@%')
) and
party.urn in
(
select
party.urn
from
Party party,
Contactpointmap contactpointmap,
Contactpoint contactpoint,
Address address
where
party.urn=contactpointmap.party.urn and
contactpointmap.contactpoint.contactpointurn=contactpoint.contactpointurn and
contactpoint.address.addressid=address.addressid and
lower(address.city) like 'dublin'
) and
lower(party.person.firstname) like 'a%' and
(
party.person is not null and
party.person.purn <> 0
)
order by
party.person.lastname,
party.person.firstname asc
So everything after that first subselect is missing from the sql. If I move all of the other criteria before that email subselect, they are included. But still the order by clause is omitted. There is nothing unusual in the hbm files. And it seems to be only affected by where the email subselect is, it doesn't matter where the other subselect is. If I remove the email subselect, everything works as expected.
The generated sql still executes without error, and returns results expected for the sql, but only applys the email criterion.
Am I doing something wrong? Thanks if you can help.
Juo
|