We have a Spring/Hibernate app and would like to add a small amount of JDBC for reasons involving performance and development time. I can make this dao subclass HibernateDaoSupport and use the session’s connection to perform my JDBC, but I’d rather use JdbcTemplate. JdbcTemplate, however is initialized using a java.sql.Datasource. How can I use my existing Hibernate SessionFactory to initialize it?
Share
Aren’t you required to provide a DataSource to the SessionFactory implementation? Why don’t you wire that in to the JDBC Template?
Which SessionFactory implementation are you using? If you’re using the Spring implementations, see AbstractSessionFactoryBean.html#getDataSource()