In my application, I use Hibernate with SQL Server database, so I set
I have found the answer from this post : Resolve SQL dialect using hibernate
Thank you for @Dewfy,
here is the solution:
//take from current EntityManager current DB Session
Session session = (Session) em.getDelegate();
//Hibernate's SessionFactoryImpl has property 'getDialect', to
//access this I'm using property accessor:
Object dialect =
org.apache.commons.beanutils.PropertyUtils.getProperty(
session.getSessionFactory(), "dialect");
//now this object can be casted to readable string:
if (dialect.toString().equals("org.hibernate.dialect.SQLServerDialect")) {
} else {
}