My problem is that i can insert data but when i tried to update or delete, anything appens : the execution is finished welled with any exception but my data is not updated
Hibernate version: 2.1.7.c
[b]Mapping documents:
<?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="fr.tm.vif.decision.metier.objet.Parametre" table="DPARAM">
<composite-id>
<key-property column="csoc" name="code_societe" type="string" />
<key-property column="cetab" name="code_etablissement" type="string" />
<key-property column="cparam" name="code_parametre" type="string" />
<key-property column="ctypeparam" name="type_parametre" type="string" />
</composite-id>
<property column="lparam" name="lib_parametre" type="string"/>
<property column="cacces" name="niveau_acces" type="string"/>
<property column="commentaire" name="commentaire" type="string"/>
<property column="datecre" name="date_creation" type="timestamp"/>
<property column="cusercre" name="utilisateur_creation" type="string"/>
<property column="datemodif" name="date_modification" type="timestamp"/>
<property column="cusermodif" name="utilisateur_modification" type="string"/>
<property column="valchar" name="valeur_caractere" type="string"/>
<property column="valchar1" name="valeur_caractere1" type="string"/>
<property column="valchar2" name="valeur_caractere2" type="string"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
try
{
session = HibernateManager.getSession();
tx = session.beginTransaction();
Query query = session.createQuery(
"from Parametre p where p.code_societe = :csoc and p.code_etablissement = :cetab and p.code_parametre = :cparam and p.lib_parametre = :lparam ");
query.setString("csoc", p.getCode_societe());
query.setString("cetab", p.getCode_etablissement());
query.setString("cparam", p.getCode_parametre());
query.setString("lparam", p.getLib_parametre());
List liste = query.list();
if (liste.size() >= 1)
{
Parametre par = (Parametre) liste.get(0);
par.setValeur_caractere("modifie");
session.update(par);
session.flush();
//session.
tx.commit();
}
else
{
}
}
catch (HibernateException ex)
{
if (tx != null)
{
try
{
tx.rollback();
}
catch (HibernateException ex1)
{
System.out.println("ok");
}
}
ex.printStackTrace();
}
finally
{
try
{
session.close();
}
catch (HibernateException ex2)
{
System.out.println("ok");
}
}
Full stack trace of any exception that occurs:
Any exception occurs
Name and version of the database you are using:
Oracle 8.1.7.4.0
The generated SQL (show_sql=true):
DEBUG [main] net.sf.hibernate.SQL - select parametre0_.csoc as csoc, parametre0_.cetab as cetab, parametre0_.cparam as cparam, parametre0_.ctypeparam as ctypeparam, parametre0_.lparam as lparam, parametre0_.cacces as cacces, parametre0_.commentaire as commenta7_, parametre0_.datecre as datecre, parametre0_.cusercre as cusercre, parametre0_.datemodif as datemodif, parametre0_.cusermodif as cusermodif, parametre0_.valchar as valchar, parametre0_.valchar1 as valchar1, parametre0_.valchar2 as valchar2 from DPARAM parametre0_ where (parametre0_.csoc=? )and(parametre0_.cetab=? )and(parametre0_.cparam=? )and(parametre0_.lparam=? )
DEBUG [main] net.sf.hibernate.SQL - update DPARAM set lparam=?, cacces=?, commentaire=?, datecre=?, cusercre=?, datemodif=?, cusermodif=?, valchar=?, valchar1=?, valchar2=? where csoc=? and cetab=? and cparam=? and ctypeparam=?
Debug level Hibernate log excerpt:
Any exception occurs
|