-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: HQL Problem - right results from SQL but not from Hibernate
PostPosted: Tue Oct 02, 2007 5:49 pm 
Newbie

Joined: Wed Jun 21, 2006 7:10 pm
Posts: 6
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 work
Code:
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()
  )


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 03, 2007 9:02 am 
Newbie

Joined: Mon Oct 01, 2007 8:59 am
Posts: 18
write this in hibernate.cfn.xml
and try
<property name="dialect">org.hibernate.dialect.SQLServerDialect
</property>


Top
 Profile  
 
 Post subject: HQL Problem - right results from SQL but not from Hibernate
PostPosted: Wed Oct 03, 2007 9:26 am 
Newbie

Joined: Wed Jun 21, 2006 7:10 pm
Posts: 6
I already had this in the configuration.

Code:
<property name="hibernate.dialect">
         org.hibernate.dialect.SQLServerDialect
      </property>

It generates the correct SQL. If I paste that SQL into enterprise manager it returns the correct results.

Somehow, when the results are returned Hibernate is having a problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.