Root Cause:
------------
java.lang.RuntimeException: Exception building SessionFactory: Repeated column in mapping for entity: com.ccne.bo.Root Cause:
------------
java.lang.RuntimeException: Exception building SessionFactory: Repeated column in mapping for entity: com.ccne.bo.MovimentoEstoque column: COD_DEPENDENCIA (should be mapped with insert="false" update="false")
at com.bm.infra.persistence.hibernate.SessionManager.currentSession(SessionManager.java:34)
at com.bm.infra.persistence.hibernate.HibernatePersistenceManager.find(HibernatePersistenceManager.java:185)
at com.bm.infra.persistence.hibernate.HibernatePersistenceManager.find(HibernatePersistenceManager.java:175)
Here´s the hbm.xml... middlegen has generated the class MovimentoEstoquePK but it was deleted, i don´t know if it might be the reason for this error.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="com.ccne.bo">
<class
name="MovimentoEstoque"
table="TB_MOVIMENTO_ESTOQUE"
>
<id
name="numMovimentoEstoque"
type="int"
column="NUM_MOVIMENTO_ESTOQUE"
>
<generator class="assigned" />
</id>
<property
name="datMovimentoEstoque"
type="java.sql.Timestamp"
column="DAT_MOVIMENTO_ESTOQUE"
not-null="true"
length="23"
/>
<property
name="numDocumento"
type="int"
column="NUM_DOCUMENTO"
not-null="true"
length="10"
/>
<property
name="qtdMovimentoEstoque"
type="java.math.BigDecimal"
column="QTD_MOVIMENTO_ESTOQUE"
not-null="true"
length="18"
/>
<property
name="idtTipoMovimento"
type="java.lang.String"
column="IDT_TIPO_MOVIMENTO"
not-null="true"
length="1"
/>
<property
name="idtEntSai"
type="java.lang.String"
column="IDT_ENT_SAI"
not-null="true"
length="1"
/>
<property
name="desMotivo"
type="java.lang.String"
column="DES_MOTIVO"
length="255"
/>
<!-- Associations -->
<!-- bi-directional many-to-one association to TbFornecedor -->
<many-to-one
name="fornecedor"
class="Fornecedor"
not-null="true"
>
<column name="COD_CGC_CPF" />
<column name="COD_SERIE" />
<column name="COD_CONTROLE" />
</many-to-one>
<!-- bi-directional many-to-one association to TbServicoDnc -->
<many-to-one
name="servicoDNC"
class="ServicoDNC"
not-null="true"
>
<column name="COD_TIPO_FAMILIA_INSUMO" />
<column name="COD_DEPENDENCIA" />
<column name="COD_FAMILIA_DNC" />
<column name="COD_SERVICO_DNC" />
</many-to-one>
<!-- bi-directional many-to-one association to TbAlmoxarifado -->
<many-to-one
name="almoxarifado"
class="Almoxarifado"
not-null="true"
>
<column name="COD_DEPENDENCIA" />
<column name="COD_ALMOXARIFADO" />
</many-to-one>
<!-- bi-directional many-to-one association to InsumoObra -->
<many-to-one
name="insumoObra"
class="InsumoObra"
not-null="true"
>
<column name="COD_INSUMO_OBRA" />
</many-to-one>
<!-- bi-directional many-to-one association to ServicoObra -->
<many-to-one
name="servicoObra"
class="ServicoObra"
not-null="true"
>
<column name="COD_DEPENDENCIA" />
<column name="COD_FAMILIA_SERVICO" />
<column name="COD_SERVICO_OBRA" />
</many-to-one>
</class>
</hibernate-mapping>
column: COD_DEPENDENCIA (should be mapped with insert="false" update="false")
at com.bm.infra.persistence.hibernate.SessionManager.currentSession(SessionManager.java:34)
at com.bm.infra.persistence.hibernate.HibernatePersistenceManager.find(HibernatePersistenceManager.java:185)
at com.bm.infra.persistence.hibernate.HibernatePersistenceManager.find(HibernatePersistenceManager.java:175)
Here´s the
O problema parece estar aqui nas chaves compostas.O middlegen gerou o xml com uma classe MovimentoEstoquePK que foram removidos, não sei este pode ter sido o motivo.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="com.ccne.bo">
<class
name="MovimentoEstoque"
table="TB_MOVIMENTO_ESTOQUE"
>
<id
name="numMovimentoEstoque"
type="int"
column="NUM_MOVIMENTO_ESTOQUE"
>
<generator class="assigned" />
</id>
<property
name="datMovimentoEstoque"
type="java.sql.Timestamp"
column="DAT_MOVIMENTO_ESTOQUE"
not-null="true"
length="23"
/>
<property
name="numDocumento"
type="int"
column="NUM_DOCUMENTO"
not-null="true"
length="10"
/>
<property
name="qtdMovimentoEstoque"
type="java.math.BigDecimal"
column="QTD_MOVIMENTO_ESTOQUE"
not-null="true"
length="18"
/>
<property
name="idtTipoMovimento"
type="java.lang.String"
column="IDT_TIPO_MOVIMENTO"
not-null="true"
length="1"
/>
<property
name="idtEntSai"
type="java.lang.String"
column="IDT_ENT_SAI"
not-null="true"
length="1"
/>
<property
name="desMotivo"
type="java.lang.String"
column="DES_MOTIVO"
length="255"
/>
<!-- Associations -->
<!-- bi-directional many-to-one association to TbFornecedor -->
<many-to-one
name="fornecedor"
class="Fornecedor"
not-null="true"
>
<column name="COD_CGC_CPF" />
<column name="COD_SERIE" />
<column name="COD_CONTROLE" />
</many-to-one>
<!-- bi-directional many-to-one association to TbServicoDnc -->
<many-to-one
name="servicoDNC"
class="ServicoDNC"
not-null="true"
>
<column name="COD_TIPO_FAMILIA_INSUMO" />
<column name="COD_DEPENDENCIA" />
<column name="COD_FAMILIA_DNC" />
<column name="COD_SERVICO_DNC" />
</many-to-one>
<!-- bi-directional many-to-one association to TbAlmoxarifado -->
<many-to-one
name="almoxarifado"
class="Almoxarifado"
not-null="true"
>
<column name="COD_DEPENDENCIA" />
<column name="COD_ALMOXARIFADO" />
</many-to-one>
<!-- bi-directional many-to-one association to InsumoObra -->
<many-to-one
name="insumoObra"
class="InsumoObra"
not-null="true"
>
<column name="COD_INSUMO_OBRA" />
</many-to-one>
<!-- bi-directional many-to-one association to ServicoObra -->
<many-to-one
name="servicoObra"
class="ServicoObra"
not-null="true"
>
<column name="COD_DEPENDENCIA" />
<column name="COD_FAMILIA_SERVICO" />
<column name="COD_SERVICO_OBRA" />
</many-to-one>
</class>
</hibernate-mapping>
Thanks in advance for any help
|