-->
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.  [ 5 posts ] 
Author Message
 Post subject: sysdate expression throw unknow column exception
PostPosted: Tue Jan 03, 2006 5:02 am 
Regular
Regular

Joined: Mon Aug 02, 2004 9:33 am
Posts: 69
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1


Name and version of the database you are using: Mysql 5.1.12





Collection categories = getHibernateTemplate().find(
"from Category cat where cat.parentCategory.id = null and (cat.categoryDetails.expire is null or cat.categoryDetails.expire > sysdate)");



I got an unknown column 'sysdate' exception. Pls help, Thanks !

regards,
Mark


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 5:28 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
More info required.

what is sysdate? column or value of a Date Object????????

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 7:18 am 
Regular
Regular

Joined: Wed May 05, 2004 8:01 am
Posts: 53
as sysdate is a no arg function the query syntax should be:

from Category cat where cat.parentCategory.id = null and (cat.categoryDetails.expire is null or cat.categoryDetails.expire > sysdate())

did that help?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 03, 2006 9:28 pm 
Regular
Regular

Joined: Mon Aug 02, 2004 9:33 am
Posts: 69
I went to http://www.hibernate.org/hib_docs/refer ... ryhql.html

and found that hibernate able to distinguish sysdate just like when u do a select sysdate in oracle database !


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 8:04 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
i think that sysdate in mysql is
now() or curdate()
but for this query it is better usage parameter and add date from java (it work for any database)
another problem with this query is

cat.parentCategory.id = null

this return no rows always - it is false always


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.