-->
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.  [ 2 posts ] 
Author Message
 Post subject: Using dates without binding a parameter
PostPosted: Wed Dec 10, 2003 8:03 am 
Newbie

Joined: Wed Dec 03, 2003 1:34 pm
Posts: 9
Just curious, is this possible?

session.find("SELECT * from table where table.date_field = <a_date_value>")

I know I could turn the date into a string - but then I'll get date format issues unless every database used has the same date format.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 10:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The HQL is translated to SQL so in general if it makes sense in SQL you might just be able to do it in HQL (but with less complications). In this case, if you db accepts the translated syntax then yes. Most dbs that I know would not accept the syntax. You may need to convert tyhe string representation to a date using a db function (such as to_date() in Oracle). Now I do suggest you pass parameters where in this case it would be a java date object.


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