Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve auto-detected hibernate dialect

Hibernate has the option to auto-detetect the hibernate.dialect. How can I retrieve that auto-detected value? I was unable to find any information on this.

like image 365
user101442 Avatar asked Oct 15 '09 11:10

user101442


1 Answers

You can retrieve it from the SessionFactory but you'll need to cast it to SessionFactoryImplementor first:

SessionFactory sessionFactory = ...; // you should have this reference
Dialect dialect = ((SessionFactoryImplementor) sessionFactory).getDialect();

The above will retrieve the dialect instance currently being used by session factory, which is the auto detected instance if it wasn't explicitly specified via properties.

like image 98
ChssPly76 Avatar answered Sep 18 '22 07:09

ChssPly76