Hi all,
I searched around and make some tests but I have still the same problem: hibernate don't save on DB.
I'm working on an SWT application that uses Hibernate and HSQLDB.
When I was working with HSQLDB version 1.7.2.11 and Hibernate 3.0.5 everithing was ok, but when i upgraded to HSQLDB version 1.8.0.7 and Hibernate 3.2.5 I found that my changes weren't saved on DB.
I tried various version of HSQLDB and Hibernate, but the problem still remain because I have to use a version of HSQLDB >= 1.8.0.2
Here is my hibernate.cfg.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="hibernate.connection.url">jdbc:hsqldb:C:/nuovoDBStime/stime</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<mapping resource="it/eng/cmm/stime/model/TSpAttStimaProg.hbm.xml" />
....
<mapping resource="it/eng/cmm/stime/model/TSpRilasci.hbm.xml" />
</session-factory>
</hibernate-configuration>
And here there is a simple test:
Code:
session = HibernateUtil.getSession();
tx = session.beginTransaction();
String codProg = "LL05";
Integer versStima = 2;
short progrOggStima = 3;
BigDecimal value = new BigDecimal(1335);
TSpValOggGlobStimaId id = new TSpValOggGlobStimaId(codProg, versStima, progrOggStima);
TSpValOggGlobStima valOggGlobStima = (TSpValOggGlobStima)session.get(TSpValOggGlobStima.class, id);
System.out.println(">>>> "+ valOggGlobStima.getValStima()); /// first output = 333
valOggGlobStima.setValStima(value);
System.out.println(">>>> "+ valOggGlobStima.getValStima()); /// second output = 1335
tx.commit();
session.close();
If I run this snippet two times the first output should be the first time 333 and the second time it should be 1335, but it is not!
No errors given from hibernate...
Thanks for any ideas,
Luca.