DateDiff in sleep mode

How to use Datediff (MySQL) in Hibernate?

+4
source share
2 answers
+3
source

It’s better to realize your own dialect. Something like that

import org.hibernate.dialect.SQLServerDialect; import org.hibernate.dialect.function.VarArgsSQLFunction; import org.hibernate.type.StandardBasicTypes; public class MsSqlDialect extends SQLServerDialect { public MsSqlDialect() { super(); registerFunction("DATEDIFF", new VarArgsSQLFunction(StandardBasicTypes.INTEGER, "dateDiff(", ",", ")")); } } 
+1
source

Source: https://habr.com/ru/post/1340001/


All Articles