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: PluginHibernateSessionFactory (Atlassian Confluence 6.6.0 API)
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: TransactionalExecutor (Shared Application Access Layer API 3.1.1 API)

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