Solved

Looking for an HQL Query to parse Calendar Date

Posted on 2011-09-06
5
724 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now