Hibernate session related bug has been fixed

* a lot of changes related to session obtaining have been introduced