Yeah, i tried that. And works fine.
Now, the problem remains when multiple many-to-one relationships share columns. In this case key-many-to-one doesn't allow to share columns and it doesn't have the attributes update and insert to set the "false".
NOTE: the database schema can't be changed
Example:
Code:
<composite-id
name="pkReal"
class="net.technisys.bancoval.credival.domain.service.portfolio.guarantee.asset.AssetGuaranteePrimaryKey"
>
<key-property
name="assetCode"
type="java.lang.String"
column="cod_valor"
/>
<key-property
name="company"
type="java.lang.String"
column="cod_empresa"
/>
<key-property
name="personIntCode"
type="java.lang.String"
column="cod_int_persona"
/>
<key-property
name="portfolioCode"
type="java.lang.String"
column="cod_cartera"
/>
</composite-id>
<many-to-one
name="portfolioGuarantee"
class="net.technisys.bancoval.credival.domain.service.portfolio.guarantee.PortfolioGuaranteeBusiness"
cascade="none"
outer-join="auto"
update="false"
insert="false"
access="property"
>
<column
name="cod_empresa"
/>
<column
name="cod_cartera"
/>
</many-to-one>
<many-to-one
name="personGuarantee"
class="net.technisys.bancoval.credival.domain.service.portfolio.guarantee.asset.person.PersonGuaranteeBusiness"
cascade="none"
outer-join="auto"
update="false"
insert="false"
access="property"
>
<column
name="cod_empresa"
/>
<column
name="cod_int_persona"
/>
<column
name="cod_cartera"
/>
</many-to-one>
Code: