I would need some clarification about JPA/Hibernate inheritance.
Say I have an abstract Fruit entity that is subclassed by two Apple and Orange entities. Furthermore, I have an instance of Orange in database.
Can I retrieve this instance from database as a plain Fruit and cast it to Orange?
Well you can do:
and in runtime will be the appropriate type. But if you write a
HQLyou can check for its runtime type. This is usually unneeded if you are done your inheritance and mapping well.