-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Automatic CASCADE Deleting
PostPosted: Wed Jun 21, 2006 9:59 am 
Newbie

Joined: Thu Jul 21, 2005 10:17 am
Posts: 17
The problems is:


I have a POJO Tabelacusta with three Itemtabelacusta on setItemtabelacustas() of Tabelacusta , OK i pass the Pojo to a client using EJB Session Bean...

On client I call

TabelacustaVo.getItemtabelacustas().remove(addr2);

An put back to session bean , and call session.saveOrUpdate(TabelacustaVo)..

The Address with key addr2 is not deleted, exists way to do that ?

The hibernate not delete a "deleted recerence of Set" ?

Tnks !



Hibernate version: 3.1.2

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 14/03/2006 09:13:05 by Hibernate Tools 3.1.0 beta1JBIDERC2 -->
<hibernate-mapping>
<class name="hibernate.Tabelacusta" table="tabelacusta" >
<id name="TsId" type="integer">
<column name="ts_id" />
<generator class="increment" />
</id>
<property name="TsEscopo" type="string">
<column name="ts_escopo" length="5" not-null="true" />
</property>
<property name="TsTabela" type="string">
<column name="ts_tabela" length="50" not-null="true" />
</property>
<property name="TsVigenciaIni" type="date">
<column name="ts_vigenciaIni" length="10" not-null="true" />
</property>
<property name="TsVigenciaFim" type="date">
<column name="ts_vigenciaFim" length="10" not-null="true" />
</property>
<property name="TsCodigoContabil" type="string">
<column name="ts_codigoContabil" length="10" not-null="true" />
</property>
<property name="TsObs" type="string">
<column name="ts_obs" length="65535" not-null="true" />
</property>
<set name="Itemtabelacustas" cascade="save-update,delete-orphan" inverse="true">
<key>
<column name="it_tabelaCusta" not-null="true" />
</key>
<one-to-many class="hibernate.Itemtabelacusta" />
</set>
</class>
</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 14/03/2006 09:13:04 by Hibernate Tools 3.1.0 beta1JBIDERC2 -->
<hibernate-mapping>
<class name="hibernate.Itemtabelacusta" table="itemtabelacusta">
<id name="ItId" type="integer" unsaved-value="0">
<column name="it_id" />
<generator class="increment" />
</id>
<many-to-one name="Tabelacusta" class="hibernate.Tabelacusta" lazy="false">
<column name="it_tabelaCusta" not-null="true" />
</many-to-one>
<property name="ItAutoSugerir" type="integer">
<column name="it_autoSugerir" not-null="true" />
</property>
<property name="ItCodCusta" type="string">
<column name="it_codCusta" length="10" not-null="true" />
</property>
<property name="ItDescricao" type="string">
<column name="it_descricao" not-null="true" />
</property>
<property name="ItBaseMin" type="double">
<column name="it_baseMin" precision="16" not-null="true" />
</property>
<property name="ItBaseMax" type="double">
<column name="it_baseMax" precision="16" not-null="true" />
</property>
<property name="ItValorMin" type="double">
<column name="it_valorMin" precision="16" not-null="true" />
</property>
<property name="ItValorMax" type="double">
<column name="it_valorMax" precision="16" not-null="true" />
</property>
<set name="Itemcustas" inverse="true" lazy="true">
<key>
<column name="is_itemTabelaCusta" not-null="true" />
</key>
<one-to-many class="hibernate.Itemcusta" />
</set>
<set name="Valortabelacustas" cascade="save-update,delete-orphan" inverse="true">
<key>
<column name="vt_itemTabelaCusta" not-null="true" />
</key>
<one-to-many class="hibernate.Valortabelacusta" />
</set>
</class>
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():

session.saveOrUpdate(TabelacustaVo);

or

session.merge(TabelacustaVo);


Full stack trace of any exception that occurs:
none

Name and version of the database you are using:
MySQL 5.0.20 with InnoDB Tables

The generated SQL (show_sql=true):
10:40:26,156 INFO [STDOUT] Hibernate: update tabelacusta set ts_escopo=?, ts_tabela=?, ts_vigenciaIni=?, ts_vigenciaFim=?, ts_codigoContabil=?, ts_obs=? where ts_id=?
10:40:26,171 INFO [STDOUT] Hibernate: select tabelacust0_.ts_id as ts1_1403_0_, tabelacust0_.ts_escopo as ts2_1403_0_, tabelacust0_.ts_tabela as ts3_1403_0_, tabelacust0_.ts_vigenciaIni as ts4_1403_0_, tabelacust0_.ts_vigenciaFim as ts5_1403_0_, tabelacust0_.ts_codigoContabil as ts6_1403_0_, tabelacust0_.ts_obs as ts7_1403_0_ from tabelacusta tabelacust0_ where tabelacust0_.ts_id=?
10:40:26,250 INFO [STDOUT] Hibernate: select itemtabela0_.it_id as it1_1373_, itemtabela0_.it_tabelaCusta as it2_1373_, itemtabela0_.it_autoSugerir as it3_1373_, itemtabela0_.it_codCusta as it4_1373_, itemtabela0_.it_descricao as it5_1373_, itemtabela0_.it_baseMin as it6_1373_, itemtabela0_.it_baseMax as it7_1373_, itemtabela0_.it_valorMin as it8_1373_, itemtabela0_.it_valorMax as it9_1373_ from itemtabelacusta itemtabela0_ where itemtabela0_.it_tabelaCusta=? and itemtabela0_.it_baseMin<=? and itemtabela0_.it_baseMax>=?
10:40:26,328 INFO [STDOUT] Hibernate: select tabelacust0_.ts_id as ts1_1403_0_, tabelacust0_.ts_escopo as ts2_1403_0_, tabelacust0_.ts_tabela as ts3_1403_0_, tabelacust0_.ts_vigenciaIni as ts4_1403_0_, tabelacust0_.ts_vigenciaFim as ts5_1403_0_, tabelacust0_.ts_codigoContabil as ts6_1403_0_, tabelacust0_.ts_obs as ts7_1403_0_ from tabelacusta tabelacust0_ where tabelacust0_.ts_id=?
10:40:26,343 INFO [STDOUT] Hibernate: select valortabel0_.vt_id as vt1_1412_, valortabel0_.vt_itemTabelaCusta as vt2_1412_, valortabel0_.vt_posicao as vt3_1412_, valortabel0_.vt_valor as vt4_1412_, valortabel0_.vt_numViaGratuita as vt5_1412_, valortabel0_.vt_adicionalVia as vt6_1412_, valortabel0_.vt_valorMin as vt7_1412_, valortabel0_.vt_valorMax as vt8_1412_ from valortabelacusta valortabel0_ where valortabel0_.vt_itemTabelaCusta=?
10:40:26,421 INFO [STDOUT] Hibernate: select itemtabela0_.it_id as it1_1373_0_, itemtabela0_.it_tabelaCusta as it2_1373_0_, itemtabela0_.it_autoSugerir as it3_1373_0_, itemtabela0_.it_codCusta as it4_1373_0_, itemtabela0_.it_descricao as it5_1373_0_, itemtabela0_.it_baseMin as it6_1373_0_, itemtabela0_.it_baseMax as it7_1373_0_, itemtabela0_.it_valorMin as it8_1373_0_, itemtabela0_.it_valorMax as it9_1373_0_ from itemtabelacusta itemtabela0_ where itemtabela0_.it_id=?
10:40:26,437 INFO [STDOUT] Hibernate: select tabelacust0_.ts_id as ts1_1403_0_, tabelacust0_.ts_escopo as ts2_1403_0_, tabelacust0_.ts_tabela as ts3_1403_0_, tabelacust0_.ts_vigenciaIni as ts4_1403_0_, tabelacust0_.ts_vigenciaFim as ts5_1403_0_, tabelacust0_.ts_codigoContabil as ts6_1403_0_, tabelacust0_.ts_obs as ts7_1403_0_ from tabelacusta tabelacust0_ where tabelacust0_.ts_id=?






Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 7:24 am 
Newbie

Joined: Thu Jul 21, 2005 10:17 am
Posts: 17
any help ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.