I'm facing a problem with class mapping in hibernate. I'm trying to make a many-to-one relationship using a composite-id. and the mapping is returning
Repeated column in mapping for entity: br.com.is.isenterprise.cre.model.ClienteRegraIcmsMap column: EMPRESAID (should be mapped with insert="false" update="false")
but if I set the many-to-one relationship to insert =" false " and update =" false I can not insert the id of regraIcmsSubistituta in the database.
follows the hbm files.
RegraIcms.hbm.xml
<hibernate-mapping package="br.com.is.isenterprise.efi.model">
<class name="RegraIcms" table="REGRAICMS">
<composite-id name="cid" class="br.com.is.isenterprise.efi.model.RegraIcmsId">
<key-property name="empCod" type="integer" column="EMPCOD"/>
<key-property name="idRegraIcms" type="integer" column="IDREGRAICMS"/>
</composite-id>
<property name="descricao" type="string" column="DESCRICAO" access="field"/>
<property name="aplicacao" type="integer" column="APLICACAO" access="field"/>
</class>
</hibernate-mapping>
ClienteRegraIcmsMapId.hbm.xml
<class name="ClienteRegraIcmsMap" table="CLIENTEREGRAICMSMAP">
<composite-id name="cid" class="br.com.is.isenterprise.cre.model.ClienteRegraIcmsMapId">
<key-many-to-one name="cliente" column="CLIENTEID" class="br.com.is.isenterprise.cre.model.Cliente" access="field" lazy="false"/>
<key-many-to-one name="regraIcms" class="br.com.is.isenterprise.efi.model.RegraIcms" access="field" lazy="false">
<column name="EMPRESAID"/>
<column name="REGRAICMSID"/>
</key-many-to-one>
</composite-id>
<version name="versao" type="integer" column="VERSAO"/>
<many-to-one name="regraIcmsSubstituta" class="br.com.is.isenterprise.efi.model.RegraIcms" access="field" lazy="false">
<column name="EMPRESAID"/>
<column name="REGRAICMSSUBSTITUTAID"/>
</many-to-one>
</class>
</hibernate-mapping>