Java – hibernate condition groups start with timestamp by date

I have a table with a timestamp column and want to create a hibernate conditional projection. The results are grouped only according to the date in the timestamp column (the result in the database is yyyy-mm-dd HH: mm: SS)

In addition, can I write the same projection for MySQL and oracle?

Solution

You can try using the date function in sqlgroup projection:

Projections.sqlGroupProjection("date(timestampField) as myDate","myDate",new String[] { "myDate" },new Type[] { StandardBasicTypes.DATE })
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>