How to get Hibernate dialect during runtime
问题 In my application, I use Hibernate with SQL Server database, so I set <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"> in my persistence.xml. In some case, I want to sort records with NULL include, I use keyword NULLS FIRST. Because it is not supported by default by CriteriaQuery/CriteriaBuilder in Hibernate, then I use Interceptor to modify the native query. The problem is, keyword NULLS FIRST is not supported in SQL Server, so I use keyword: case when