Class A many-to-one references Class B. Class B is the root of an inheritance hierarchy and has a proxy interface declared, Proxy B.
In Class A a property is generated by hbm2java for the many-to-one reference to Class B:
ClassB myClassB;
And the corresponding getter & setter method, both using ClassB as the type.
However when Hibernate loads these objects lazily there is a ClassCastException because the loaded object implements ProxyB and cannot be cast to ClassB.
I believe in this case that hbm2java should use ProxyB as the type for this property in Class A.
I have produced a pull request that adds this behaviour. Hoping it's the right behaviour!
|