开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜