Solved

Looking for an HQL Query to parse Calendar Date

Posted on 2011-09-06
5
762 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
  • 2
  • 2
5 Comments
 
LVL 40

Expert Comment

by:gurvinder372
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:gurvinder372
ID: 36516404
this solution is mentioned in the link
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet example 11 58
web application structure 18 112
Java class and jar 3 42
Netbeans and org.apache.commons.lang3 issue 3 26
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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 video teaches viewers about errors in exception handling.

749 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