Unfortunately, I'm lost here. From here, a Hibernate developer who knows the internal structures better would have to take over.
This is not a simple bug fix, there is probably more to be rebuilt here.