Fixes #1039
Merge pull request #1043 from mdogan/fix/3.1/hibernate

Fixes #1039