session.connection() deprecated on Hibernate?

You now have to use the Work API:

session.doWork(
    new Work() {
        public void execute(Connection connection) throws SQLException 
        { 
            doSomething(connection); 
        }
    }
);

Or, in Java 8+ :

session.doWork(connection -> doSomething(connection)); 

Leave a Comment