Pull request (https://github.com/hibernate/hibernate-orm/pull/898 ) - resolves the problem using the second of the approaches mentioned above.