I have a one-to-one relationship between the dealer and the seller, who should be lazy with a proxy. For the party on which the foreign key is determined (seller, refers to the dealer), this works fine. But this does not work on the other hand - the seller is always loaded with impatience. I installed constrained="true"as described in “Some explanations for lazy loading,” but that didn't help.
The following is the mapping used:
<class name="Role" table="PER_PERSROLE" abstract="true">
<id column="OID" type="long">
<generator class="native" />
</id>
<discriminator column="SUBTYPE" type="string" />
</class>
<subclass name="Dealer" extends="Role" discriminator-value="DEAL">
<property name="gpNr" column="GP_NR" type="string" />
<one-to-one name="seller" property-ref="dealer" lazy="proxy" constrained="true"
outer-join="false" />
</subclass>
<subclass name="Seller" extends="Role" discriminator-value="SELL">
<many-to-one name="dealer" column="SELLER_DEALEROID" lazy="proxy"
outer-join="false" />
</subclass>
Is there a problem that both classes are in the same table? I see that strictly speaking, the relation is not limited in the database (it cannot use this model), but both entities are always needed for the domain model, and the application provides this.