Current Hibernate session

Hello people,
Hope someone can help me. Custom plugin executes SQL query in order to receive some amount of data. It gets current hibernate session via PluginHibernateSessionFactory: https://docs.atlassian.com/atlassian-confluence/6.6.0/com/atlassian/hibernate/PluginHibernateSessionFactory.html
But I noticed that it is marked as deprecated. I want to change it to something that is not deprecated, but I am stuck here. Can anybody point me how to get current session w/t PluginHibernateSessionFactory? Thank you in advance.

In general hitting the database directly is kinda bad (Atlassian would really like for us to use ActiveObjects etc). Depending on what you’re doing - you’ll impact the scalability of the host app.

That said - take a look at SAL: https://docs.atlassian.com/sal-api/3.1.1/sal-api/apidocs/com/atlassian/sal/api/rdbms/TransactionalExecutor.html

Seems it is what I am looking for. Thank you!