-->
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: composite-element does not get updated
PostPosted: Tue Aug 29, 2006 2:52 pm 
Newbie

Joined: Sat May 22, 2004 1:47 pm
Posts: 13
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hi,

I have a composite-element that can be read normally but I can´t get the field "LIDO" updated. I really don´t know what is going on...
Any ideas? Thanks.

Hibernate version:
3.2 cr2
Mapping documents:
<hibernate-mapping>
<class name="Aviso" table="AVISO">

<id name="id" type="long">
<column name="ID_AVISO" not-null="true" />
<generator class="identity" />
</id>

<set name="destinatarios"
table="AVISO_USUARIO"
cascade="save-update">
<key column="ID_AVISO" not-null="true" />
<many-to-many column="ID_USUARIO" class="Usuario" />
</set>
</class>
</hibernate-mapping>

<hibernate-mapping>
<class name="Usuario" table="USUARIO">
<id name="id" type="long">
<column name="ID_USUARIO" not-null="true" />
<generator class="identity" />
</id>

<set name="avisos"
table="AVISO_USUARIO"
inverse="true"
cascade="save-update">
<key column="ID_USUARIO" not-null="true" />
<composite-element class="AvisoUsuario">
<property name="lido" type="boolean">
<column name="LIDO" default="0" not-null="true" />
</property>
<many-to-one name="aviso"
column="ID_AVISO"
class="Aviso" />
</composite-element>
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Usuario usuario = session.get(Usuario.class, 1);
usuario.getAvisos().iterator().next().setLido(true);
session.merge(usuario);
Name and version of the database you are using:
MySQL 5.0
The generated SQL (show_sql=true):
Hibernate: select avisos0_.ID_USUARIO as ID2_0_, avisos0_.LIDO as LIDO0_, avisos
0_.ID_AVISO as ID1_0_ from AVISO_USUARIO avisos0_ where avisos0_.ID_USUARIO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?
Hibernate: select aviso0_.ID_AVISO as ID1_1042_0_, aviso0_.TITULO as TITULO1042_
0_, aviso0_.ORIGEM as ORIGEM1042_0_, aviso0_.CRIACAO as CRIACAO1042_0_, aviso0_.
INICIO as INICIO1042_0_, aviso0_.FIM as FIM1042_0_, aviso0_.CORPO as CORPO1042_0
_, aviso0_.TIPO_DESTINATARIO as TIPO8_1042_0_, aviso0_.ID_DESTINATARIO as ID9_10
42_0_, aviso0_.ID_USUARIO as ID10_1042_0_ from AVISO aviso0_ where aviso0_.ID_AV
ISO=?


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.