?
Solved

Looking for an HQL Query to parse Calendar Date

Posted on 2011-09-06
5
Medium Priority
?
780 Views
Last Modified: 2012-05-12
Hi - I need a hibernate HQL query which can parse a calendar date in a database field and extract (a) the calendar year from the date( or timestamp) and also (b) the calendar month from the date( or timestamp). The purpose is to retrieve a set of entries by year or by month

Thanks

0
Comment
Question by:abuyusuf35
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36502716
check this link
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html#queryhql-expressions

these functions are only supported if the underlying database is supporting the same, which is one of the cool things about HQL. If Hibernate doesn't understand a particular syntax, say a call to sysdate() or your adddate function that is in SQL, then it just passes the text to the database. Meaning if the database suports those functions it will work. So it means that your HQL query doesn't have to always have just HQL, but some SQL can work
0
 

Accepted Solution

by:
abuyusuf35 earned 0 total points
ID: 36516345
I found a solution to my question - select * from Holiday c where c.holidayDate between :start and :end
0
 

Author Comment

by:abuyusuf35
ID: 36516403
I've requested that this question be closed as follows:

Accepted answer: 0 points for abuyusuf35's comment http:/Q_27293994.html#36516345

for the following reason:

I found a solution elsewhere
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36516404
this solution is mentioned in the link
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question