Hi
I have this mapping file:
Code:
<class name="UnitaImmobiliare" table="UnitaImmobiliari">
....
<set name="Soggetti" table="UnitaSoggetti" generic="true" lazy="false" outer-join="true" cascade="save-update">
.....
</set>
<set name="Conduttori" table="UnitaSoggetti" where="TipoSoggetto = 'CONDU'" generic="true" lazy="true" outer-join="true" cascade="save-update">
...
</set>
<set name="Proprietari" table="UnitaSoggetti" where="TipoSoggetto = 'PROPR'" generic="true" lazy="true" outer-join="true" cascade="save-update">
</set>
So i have a base class "Soggetti" and two derived classes: "Conduttori" and "Proprietari", I am using the
Table per class hierarchy then i have a discriminator column. I am using a where clause to load separately the instances of the three classes.
I want load all my "Conduttori", "Proprietari" and "Soggetti" entities by a outer join, but only the first class in the mapping definition is loaded by a join, the others are loaded by a single query.
In my example "Soggetti" is loaded by a join but NOT "Conduttori" and "Proprietari, if in the mapping definition "Conduttori" was the first it would be loaded by a join but not "Proprietari" and "Soggetti"
Why?
Thanks in advance
Giorgio