How to detect Database from Hibernate user type? How to detect Database from Hibernate user type? oracle oracle

How to detect Database from Hibernate user type?


Use Dialect.getDialect() to retrieve your current dialect. Check the instance type to know the database .e.g below:

       Dialect dialect= Dialect.getDialect();       //<-- compare against the expected dailect classes       if(dialect instanceof OracleDialect){             //your database is oracle       }else if(dialect instanceof HSQLDialect){        //<-- compare against the expected dailect classes           //your database is HSQL       }

I am not very sure about your objective, but above should help you.