Hibernate version: 3.1.2
Mapping documents:
[code]
<set
name="participantes"
table="USUARIO"
lazy="false"
inverse="true"
cascade="all-delete-orphan"
sort="unsorted"
order-by="nome"
where="TIPO_USUARIO = 'P'"
>
<key
column="ID_EVENTO"
>
</key>
<one-to-many
class="*.*.*.*.Participante"
/>
<many-to-one
name="moderador"
class="*.*.*.*.Moderador"
cascade="all"
outer-join="auto"
update="true"
insert="true"
column="ID_MODERADOR"
/>
[code]
Hello there! I have the above mapping in one of my classes. Both Participante and Moderador descend from the same super class Usuario (using a table per class hierarchy model).
I'm having a problem when deleteing the parent entity (Evento). It's updating the child (couldn't figure if the ones from the Set or from the many-to-one) and setting their FK to null. This is causing an constraint exception on my database. It seems that Hibernate sets the FK to null, then deletes the parent, then it deletes everyone from Usuario table where ID_EVENTO = null. How do I avoid this situation?
Regards
Vinicius
|