Hi there,
I am new to Hibernate 2.1 and having some problems with session.update() in following code snippet in that the update() method doesn't update persistence data as expected. However the load(), find() all work fine.
----------------------------------------------------------------------------------
public void updateOrganisationEmail (Long oid, String email, RunContext runContext) throws HibernateException, Exception
{
java.sql.Connection databaseConnection = null;
Session session = null;
Transaction tx = null;
try {
databaseConnection = DatabaseConnectionManager.getConnection (BaseSystemConfig.isConnectionPoolingModeOnForDataSource (runContext.getDataSourceName ()), runContext);
session = sessionFactory.openSession (databaseConnection);
tx = session.beginTransaction ();
Organisation current = (Organisation) session.load (Organisation.class, oid);
current.setEmail (email);
session.update (current);
tx.commit ();
}
...
}
------------------------------------------------------------------------------------
And the Organisation.hbm.xml is as follows,
------------------------------------------------------------------------------------
<id
name="id"
type="java.lang.Long"
column="ID"
>
<generator class="assigned" />
</id>
<version
name="updateId"
type="java.lang.Integer"
column="UPDATE_ID"
/>
...
<property
name="phone"
type="java.lang.String"
column="PHONE"
length="32"
/>
<property
name="email"
type="java.lang.String"
column="EMAIL"
length="255"
/>
...
----------------------------------------------------------------------------------
I would be grateful if someone can help.
Thanks
Ray
|