This bug is the most popular Hibernate bug and has been open for quite a while. I hit it last year and created a patch that has been working perfectly for me since then. Although it seems that it wasn't used (mostly because hibernate has been changed the parts where I changed since 3.1 and also some better ideas came up), I am glad that it was fixed after all. I hope I can test it soon and be able to use, from now on, a stock version rather than patching it for each upgrade :-)
Other bugs, like this one are more than 2 years old and still not fixed. And I also provided a fix for it.