I need a connection to do some custom processing and I'd rather avoid deprecated methods. I ended up using Spring class to get the connection.
SessionFactoryUtils.getDataSource(aSF).getConnection()
I think they do use the deprecated method to get connection too though :)
Why was the call deprecated?
dkarr wrote:
When it says it's deprecated, that doesn't mean it won't work, necessarily, just that it's not recommended anymore. Technically, it might go away in a future release, but that seems unlikely to me.
When you say "custom SQL", note that you can still use a raw SQL query in the regular Hibernate interface. There are other things you might still need a raw Connection for, however. You might want to make sure what you're trying to do with "custom SQL" isn't already possible to do with Hibernate.