Steve's patch applies almost cleanly to Hibernate 4.2.23, so I was able to integrate it into JBoss 7 by backporting it and replacing the bundled version of Hibernate in JBoss with the patched version of Hibernate 4.2.23.