Hi!
I'm a bit puzzeled here... I'm trying to update a field that has previously been updated before, but it seems that Hibernate does a "rollback" after the session is closed. I'm having a hard time figuring out why.
Here's some log data:
[...]
DEBUG NullableType --> binding 'true' to parameter: 7
DEBUG NullableType --> binding 'false' to parameter: 8
DEBUG NullableType --> binding '2' to parameter: 9
DEBUG BatchingBatcher --> Adding to batch
DEBUG BatchingBatcher --> Executing batch size: 1
DEBUG BatchingBatcher --> success of batch update unknown: 0
DEBUG BatcherImpl --> done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG BatcherImpl --> closing statement
DEBUG SessionImpl --> post flush
DEBUG SessionImpl --> transaction completion
DEBUG SessionImpl --> closing session
DEBUG SessionImpl --> disconnecting session
DEBUG SessionImpl --> transaction completion
DEBUG SessionImpl --> object already associated with session
DEBUG JDBCTransaction --> commit
DEBUG SessionImpl --> flushing session
DEBUG SessionImpl --> Flushing entities and processing referenced collections
DEBUG AbstractEntityPersister --> hibernate.cats.name is dirty
DEBUG SessionImpl --> running Session.finalize()
DEBUG SessionImpl --> Updating entity: [hibernate.cats#2]
[...]
The following line could be interesting:
DEBUG AbstractEntityPersister --> hibernate.cats.name is dirty
I'm receiving no exceptions. If I exit just after the session is closed, then the "rollback" is not carried out.
Do I have to explicitly "close" persistent objects or something??
Any suggestions would be very welcome as my hair is getting thinner every minute...
Btw, here's a bit of the code I'm using to update the field:
-------------------------------------------------------------------
public void updateCatName(String newName, Integer id)
throws HibernateException
{
Session session = null;
Transaction tx = null;
try {
session = dbSessionFactory.openSession();
tx = session.beginTransaction();
Cats c = (Cats) session.load(Cats.class, id);
c.setName(newName);
session.update(m);
tx.commit();
}
catch (HibernateException hex) {
if (tx != null) tx.rollback();
throw new SMILRuntimeException(errMsg, hex);
}
finally {
session.close();
}
}
---------------------------------------------------------------------
/Jennifer
|