-->
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: Changes in transcient Object not persisted
PostPosted: Wed Feb 23, 2005 2:40 pm 
Beginner
Beginner

Joined: Wed Feb 23, 2005 2:23 pm
Posts: 21
Location: Pescara, italy
Name and version of the database you are using: mySql

Hallo!

I started working with hibernate and encounter the following problem:

One of my Objects is modfied but the new value is not persisted by the framework when I call s.update().
In the DB there's no change to the value.

Can anyone give me some hints? What are possible reasons?

Thanks
Kai

-----------
1) I load and modify an Object 'Gruppe'
Session s = HibernateUtil.currentSession();
Gruppe aktiveGruppe = (Gruppe) s.get(Gruppe.class, sessionBean.getAktiveGruppeId());

aktiveGruppe.setZone("z1");
log.info("aktiveGruppe.Zone: "+aktiveGruppe.getZone());
log.info("update start");
s.update(aktiveGruppe);
log.info("update end");

---------------
2) Due to the LOG entry the transcient Object has received the new Value 'z1' but the Value is NOT persisted by s.update(aktiveGruppe)!

19:13:03,328 [ INFO] [servlets.DoGruppe ] : 64 - aktiveGruppe.Zone: z1
19:13:03,329 [ INFO] [servlets.DoGruppe ] : 65 - update start
19:13:03,330 [DEBUG] [ibernate.impl.SessionImpl] : 1312 - object already associated with session
19:13:03,331 [ INFO] [servlets.DoGruppe ] : 67 - update end
19:13:03,332 [DEBUG] [ibernate.impl.SessionImpl] : 549 - closing session
19:13:03,334 [DEBUG] [ibernate.impl.SessionImpl] : 3294 - disconnecting session
19:13:03,335 [DEBUG] [ManagerConnectionProvider] : 114 - returning connection to pool, pool size: 1
19:13:03,336 [DEBUG] [ibernate.impl.SessionImpl] : 561 - transaction completion

-------------------
3) for further Info I add the hibernate Mapping for Gruppe.class:


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="beans.Gruppe" table="GRUPPE">

<id name="id" type="string" unsaved-value="null" >
<column name="GRUPPEN_ID" sql-type="int UNSIGNED" not-null="true"/>
<generator class="identity"/>
</id>

<set name="charakter" inverse="true" lazy="true">
<key column="GRUPPEN_ID"/>
<one-to-many class="beans.Charakter"/>
</set>

<property name="status" type="string">
<column name="STATUS" sql-type="varchar(16)" not-null="true"/>
</property>

<property name="posX" type="java.lang.Integer">
<column name="POSX" sql-type="mediumint UNSIGNED" not-null="true"/>
</property>

<property name="posY" type="java.lang.Integer">
<column name="POSY" sql-type="mediumint UNSIGNED" not-null="true"/>
</property>

<property name="zone" type="string">
<column name="ZONE" sql-type="varchar(16)"/>
</property>

<!--Dies ist die Referenz auf den Gruppenleiter -->
<many-to-one name="person" class="beans.Person" column="PERSON_ID"/>

<!--Der Aufenthaltsplanet -->
<many-to-one name="himmelskoerper" class="beans.Himmelskoerper" column="HIMMELSKOERPER_ID"/>

<!--Das Aufenthaltsgebiet-->
<many-to-one name="gebiet" class="beans.Gebiet" column="GEBIET_ID"/>

<!--Die Aufenthaltssiedlung -->
<many-to-one name="siedlung" class="beans.Siedlung" column="SIEDLUNG_ID"/>

</class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 23, 2005 3:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Start using the transaction API


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.