When i try:
Code:
regra = grupo.getRegras().remove(i);
tx = HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
factory.getRegraDAO().delete(regra);
factory.getGrupoDAO().update(grupo);
tx.commit();
I receive the follow exception:Code:
Exception occurred during event dispatching:
org.hibernate.exception.GenericJDBCException: could not update collection rows: [especialista.regra.Grupo.regras#1]
Maps:Code:
<class name="especialista.regra.Regra"
table="REGRAS">
<id
name="id"
column="REGRA_ID">
<generator class="increment"/>
</id>
<many-to-one
name="grupo"
class="especialista.regra.Grupo"
not-null="true"
column="GRUPO_ID"/>
<many-to-one
name="conclusao"
class="especialista.regra.Clausula"
cascade="all"
not-null="true"
lazy="false"/>
<list name="antecedentes" cascade="all" lazy="false">
<key column="REGRA_ID"/>
<list-index base="0"/>
<one-to-many class="especialista.regra.Clausula"/>
</list>
<property name="nome" column="NOME_REGRA"/>
<property name="descricao" column="DESCRICAO_REGRA"/>
<property name="confianca" column="CONFIANCA_REGRA"/>
<property name="tipo" column="TIPO_REGRA"/>
<property name="estado" column="ESTADO_REGRA"/>
</class>
Code:
<class name="especialista.regra.Grupo"
table="GRUPOS">
<id
name="id"
column="GRUPO_ID">
<generator class="increment"/>
</id>
<list name="regras">
<key column="GRUPO_ID"/>
<list-index base="0"/>
<one-to-many class="especialista.regra.Regra"/>
</list>
<property name="nome" column="NOME_GRUPO"/>
</class>
Anyone can help me please?
Davi