Fixed issues from different hibernate versions