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>
|