Pavel Savchyk
Pavel Savchyk

Reputation: 362

Can i get currently used hibernate dialect in grails?

I use grails 2.3.11 in my application.

Can i get currently used datasource dialect in runtime?

I just need to check what DB type i use (oracle or H2).

Thanks!

Upvotes: 0

Views: 233

Answers (1)

Burt Beckwith
Burt Beckwith

Reputation: 75671

Yes, you can call the getDialect() method in the SessionFactory. Dependency-inject the bean in a service or wherever:

def sessionFactory

and then the current Dialect instance is available using

Dialect dialect = sessionFactory.dialect

Upvotes: 2

Related Questions