13

Hibernate には、 を自動検出するオプションがありますhibernate.dialect。自動検出された値を取得するにはどうすればよいですか? これに関する情報は見つかりませんでした。

4

2 に答える 2

20

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.

于 2009-10-15T15:59:16.450 に答える