I am using Hibernate Tools to test some queries.
This query works fine and returns results:
Code:
Select p.lastName, ee.eventValue, ee.eventDate from Person p inner join p.empEvents as ee
where (ee.class = 231 and ee.eventValue <> 'A' and ee.eventDate <= current_date())
however this query returns
no results
Code:
Select p.lastName, ee.eventValue, ee.eventDate from Person p inner join p.empEvents as ee
where (ee.class = 231 and ee.eventValue <> 'A' and ee.eventDate between '9/1/2007' and current_date())
The SQL generated in the Dynamic SQL Preview runs and return results for both HQL queries.
Why does the second query not return results? (I've tried retrieving the entire object. This also does not work. HQL simply returns no results for the second query.)
Thanks
Bob
Hibernate version: 3.25GA
Name and version of the database you are using: Micrsoft SQL Server 2000
The generated SQL (show_sql=true):this is for the query that does NOT workCode:
select
person0_.LastName as col_0_0_,
empevents1_.Event_Value as col_1_0_,
empevents1_.EventDate as col_2_0_
from
People person0_
inner join
People_Emp_Events empevents1_
on person0_.Person_ID=empevents1_.Person_Link
where
empevents1_.Event_Link=231
and empevents1_.Event_Value<>'A'
and (
empevents1_.EventDate between '9/1/2007' and getdate()
)