emmanuel wrote:
Hibernate has to do the join to know the concrete implementation of your class to be consistent with the OO aproach, so loading the proerties will not make much difference.
If you want to lazy load a part of your propertires, consider mapping you joined-subclass into a one-to-one
Can't hibernate make an exception when using a discriminator ? Because the discriminator ALREADY tells Hibernate what subclass to instantiate without having to hit the table mapped to the subclass.
Thus, the behaviour that I was hoping for is that:
1) Hibernate checks the value of the discriminator column / formula, then creates an instance of the subclass as defined by the discriminator value ... BUT ... without loading the properties of the subclass. That is, it does not do a SELECT on the table mapped to the subclass.
2) When a get/set property of the subclass is then called, THEN Hibernate will do a SELECT on the table mapped to the subclass.
Reason for this is that, there are quite a few cases where we want the return a large list of entities from the parent class ... and we are not expecting to use any of the properties of the subclass, but there are some cases where we do.