Using restriction of Criteria API in hibernate for Date
The situation is like this. The format of the date in SQL server is different from oracle. In SQL server it is stored as TimeStamp. How doe开发者_运维问答s Restriction.eq , Restriction.lt, Restriction.gt work on Date objects ? Is there any way to just use date and not the time ?
According to this answer, you can use Restriction.ltProperty
and related restrictions on date fields and Hibernate will do its best to parse them.
In case this approach should not work, you can always write your restrictions in native SQL using Restrictions.sqlRestriction
.
精彩评论