Configure your SessionFactory with out database properties like URL, username and pasword.
Then whenever you call openSession method on SessionFactory, supply your current Connection.
Code:
public Session openSession(Connection connection)
So this way, session always uses your connection. But you will lose some benefits that hibernate offers when you use your own connection. One of them is Second Level Cache will be disabled.
Other options to use existing project JDBC Connection is configure the ConnectionProvider with SessionFactory. And then make this ConnectionProvider to use your database properties to make connections.