Maybe I wans't clear... what I want to do is something like this:
Code:
void myHibernateDaoMethod(...) {
getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session s) throws HibernateException {
// do something with the session
JDBCTemplate template = new JDBCTemplate(???);
template.xxx
// do something with the session
}
});
}
That is, I want to mix in the same method call both Hibernate and JDBC (I'm aware it may be dangerous, but I won't change data in the database
that has already been loaded by the hibernate sesssion).
The problem is just, JDBCTemplate wants a data source and doesn't seem happy to get just a connection, so I wanted to wrap the session's connection into a SingleConnectionDataSource.
I was just wondering if there is a cleaner way, it seems kind of an unforeseen use of SingleConnectionDataSource.