My app needs to be portable between Postgres, Mysql and for testing Hsqldb. I've setup Flyway to make some custom functions available on all three, that I now want to use in my SQL/HQL queries.
My current setup is using separate Dialect
s that I switch between using application-{profile}.yml
; which works, but the function declarations need to be duplicated among the various dialects, and it feels suboptimal.
Looking at 15.29. Non-standardized functions in the Hibernate documentation, it says I should be using org.hibernate.cfg.Configuration#addSqlFunction()
, which seems more portable and removes the need to extend all three dialects.
My issue is: How do I get access to the Hibernate Configuration
class in my Spring Boot (1.3) application? There's no bean to inject by default, and no LocalSessionFactoryBean
bean either.
Can anyone point me in the right direction, or at some other way to register my sql functions once?