NH-3048

Pull request with unit test
https://nhibernate.jira.com/browse/NH-3048