vahdat wrote:
This means that polymorphism doesn't work anymore.
On the contrary. If you were actually using polymorphism, instead of evil typecasting/instanceof, then you would not even notice this!
Back to Principles of OOP 101 for you guys!
vahdat wrote:
Does anybody know how to get the subclass S or a proxy for the subclass S?
Sure. Turn off lazy fetching. It's simply conceptually impossible to proxy a polymorphic association without breaking instanceof. You will realize this if you spend five minutes thinking about it.
Alternatively, you can use the bytecode pre-processor together with lazy="no-proxy" in HB 3.1.
But of course the best solution is never ever ever use instanceof in business logic! This is just basic OOP.
vahdat wrote:
The easiest thing to do is to turn off Hibernate's use of CGLIB using the property
The "refection optimizer" has NOTHING to do with proxies. Read the documentation.