Hi all,
basing on this
documentation I tried to use context based mapping to exclude certain parent field (province) on Municipality internal field mapping.
My main goal is to have a plain patient mapping without carrying forward all hibernate entities related to a specific field (in this case it means that I have also mapped region and country).
I tried also to use a map-id attribute on mapping tag and I also tried to repeat internal excluding field <field-exclude> on the main mapping definition with no success.
I added also a-hint and b-hint tags but nothing seems to work as expected.
Both mapping are working fine but province and related objects are never excluded from mapping. Mapping with map-id
municipality-no-province works well when it's called alone.
This is the cleaned mapping that I would expected to work:
<mapping>
<class-a>it.clevercom.echo.rd.model.entity.Patient</class-a>
<class-b>it.clevercom.echo.rd.model.dto.PatientDTO</class-b>
<field>
<a>countryByDomicileidcountry</a>
<b>docimicileCountry</b>
</field>
<field>
<a>countryByResidenceidcountry</a>
<b>residenceCountry</b>
</field>
<field>
<a>countryByBirthplaceidcountry</a>
<b>birthplaceCountry</b>
</field>
<field map-id="municipality-no-province">
<a>municipalityByDomicileidmunicipality</a>
<b>domicileMunicipality</b>
<a-hint>it.clevercom.echo.rd.model.entity.Municipality</a-hint>
<b-hint>it.clevercom.echo.rd.model.dto.MunicipalityDTO</b-hint>
</field>
<field map-id="municipality-no-province">
<a>municipalityByResidenceidmunicipality</a>
<b>residenceMunicipality</b>
<a-hint>it.clevercom.echo.rd.model.entity.Municipality</a-hint>
<b-hint>it.clevercom.echo.rd.model.dto.MunicipalityDTO</b-hint>
</field>
<field map-id="municipality-no-province">
<a>municipalityByBirthplaceidmunicipality</a>
<b>birthplaceMunicipality</b>
<a-hint>it.clevercom.echo.rd.model.entity.Municipality</a-hint>
<b-hint>it.clevercom.echo.rd.model.dto.MunicipalityDTO</b-hint>
</field>
<field>
<a>organizationUnitByIdintorganizationunit</a>
<b>internalOrgUnit</b>
</field>
<field>
<a>organizationUnitByIdextorganizationunit</a>
<b>externalOrgUnit</b>
</field>
</mapping>
<mapping map-id="municipality-no-province">
<class-a>it.clevercom.echo.rd.model.entity.Municipality</class-a>
<class-b>it.clevercom.echo.rd.model.dto.MunicipalityDTO</class-b>
<field-exclude>
<a>province</a>
<b>province</b>
</field-exclude>
</mapping>
I have no idea of what is going wrong. Does somebody has an advice to make it work?
Thank u.
Cheers,
Luca