The work around mentioned in the SO can lead to the https://hibernate.atlassian.net/browse/HHH-12997 issue.