-->
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.  [ 1 post ] 
Author Message
 Post subject: why it does UPDATE ?
PostPosted: Fri Jan 23, 2009 4:30 pm 
Newbie

Joined: Thu Jan 22, 2009 2:40 pm
Posts: 2
Hi, I've got a big problem and I'm just don't know how solve it. Mi situation is:

Hibernate version:3

Mapping documents:

Mapping of table: ResultadoCabecera

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="ar.org.hospitalitaliano.negocio.model.resultados.ResultadoCabecera" table="mf_admin.resultadobser">

<id name="id"
column="id_observacion">
<generator class="sequence">
<param name="sequence">mf_admin.seq_resultados</param>
</generator>
</id>

<many-to-one
name="episodioMedico"
class="ar.org.hospitalitaliano.negocio.model.episodios.EpisodioMedico"
cascade="none"
outer-join="auto"
lazy="true"
update="true"
insert="true"
column="nro_historia"
property-ref="nroHistoria"
not-null="false"/>

</class>
</hibernate-mapping>

Mapping of table: EpisodioMedico

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="ar.org.hospitalitaliano.negocio.model.episodios.EpisodioMedico" table="INT_INTERNACION">

<id name="id"
column="id_internacion"
type="java.lang.Long">
<generator class="identity"></generator>
</id>


<property name="nroHistoria"
type="java.lang.String"
update="true"
insert="true"
column="nro_historia"
unique="true"
not-null="true" />


<set name="resultadosCabecera"
lazy="true"
inverse="true"
cascade="save-update"
sort="unsorted" order-by="fecha_realizacion desc">
<key property-ref="nroHistoria" column="nro_historia"></key>
<one-to-many class="ar.org.hospitalitaliano.negocio.model.resultados.ResultadoCabecera"/>
</set>

<set name="interconsultasHCD"
lazy="true"
inverse="true"
cascade="save-update"
sort="unsorted" order-by="fecha desc" >
<key column="id_internacion"></key>
<one-to-many class="ar.org.hospitalitaliano.negocio.model.interconsultas.InterconsultaHCD"/>
</set>

</class>
</hibernate-mapping>

Mapping of table: interconsultasHCD

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="ar.org.hospitalitaliano.negocio.model.interconsultas.InterconsultaHCD" table="mf_admin.md_interconsulta">

<id name="id" column="id_interconsulta" >
<generator class="sequence">
<param name="sequence">mf_admin.SEC_MD_INTERCONSULTA</param>
</generator>
</id>

<many-to-one
name="episodioMedico"
class="ar.org.hospitalitaliano.negocio.model.episodios.EpisodioMedico"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="id_internacion"
not-null="true"/>

</class>
</hibernate-mapping>





When I execute the next Criteria:

Criteria crt = Hibernation.getSession().createCriteria(ResultadoCabecera.class);

crt.createCriteria("episodioMedico")
.add(Restrictions.eq("id", 1030 ));

List<ResultadoCabecera> a = crt.list();


I get the next update, beside a load of interconusltaHCD. Why it does the load and why it does the fucking update. Please, i don't know what else to do.....


Hibernate: /* load one-to-many ar.org.hospitalitaliano.negocio.model.episodios.EpisodioMedico.interconsultasHCD */ select .... from mf_admin.md_interconsulta interconsu0_ where interconsu0_.id_internacion=? order by interconsu0_.fecha desc
Hibernate: /* update ar.org.hospitalitaliano.negocio.model.episodios.EpisodioMedico */ update INT_INTERNACION set ........


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

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.