Home » Hibernate » Date range query on Timestamp field in HQL

Date range query on Timestamp field in HQL

Suppose we want to make query between two dates in a timestamp field for example
We have a table colors to store different colors

Pojo class for color table is

Above class shows that addDate is timestamp field and we want to query it as date for that we have casted timestamp field to date using cast() of hql. To fetching Color details with in date range we can use following code

Managed by MochaHost - Fast & Easy WordPress Hosting