Hi there,
First things first:
Hibernate version:2.1.6 (with JBoss 4.0.1 sp1)
Mapping documents:Simple documents, nothing special here
Code between sessionFactory.openSession() and session.close():I'm using HibernateContext.getSession(...)
Full stack trace of any exception that occurs:No exception, that's part of my problem
Name and version of the database you are using:Oracle 9i
The generated SQL (show_sql=true): Not applicable
Debug level Hibernate log excerpt: Later...
I use Hibernate in various stateless session bean and in a MDB. My database and mappings are simple, nothing special.
The problem is that when I try to delete the content of a table, Hibernate says he does it, but in the bd nothing happens.
I use
Code:
org.jboss.hibernate.session.HibernateContext.getSession("java:/hibernateDim/SessionFactory");
to obtain the hibernate session, and then
Code:
Transaction tx = null;
try {
tx = hibernateSession.beginTransaction();
logger.info("Deleting table CapacidadRequeridaBean");
hibernateSession.delete("from CapacidadRequeridaBean");
logger.info("Deleting table RechazoBean");
hibernateSession.delete("from RechazoBean");
hibernateSession.flush();
tx.commit();
} catch (Exception e) {
logger.error("Cannot clean tables",e);
if (tx != null)
tx.rollback();
} finally {
// Do nothing there. Was using closeSession() when using sessionFactory
}
to delete the tables.
When I look at the detailed debug output of hibernate, I don't see anything odd. Hibernate fetches entities to delete, prepares statements, and then does the flushing when it's called. Then it prepares all the necessary JDBC batches and executes them:
Quote:
2005-05-19 12:07:24,094 DEBUG [net.sf.hibernate.impl.BatcherImpl] Executing batch size: 15
2005-05-19 12:07:24,100 DEBUG [net.sf.hibernate.impl.BatcherImpl] success of batch update unknown: 0
2005-05-19 12:07:24,100 DEBUG [net.sf.hibernate.impl.BatcherImpl] success of batch update unknown: 1
2005-05-19 12:07:24,100 DEBUG [net.sf.hibernate.impl.BatcherImpl] success of batch update unknown: 2
2005-05-19 12:07:24,100 DEBUG [net.sf.hibernate.impl.BatcherImpl] success of batch update unknown: 3
Finally it executes :
Quote:
2005-05-19 12:07:24,140 DEBUG [net.sf.hibernate.impl.SessionImpl] post flush
2005-05-19 12:07:24,142 DEBUG [net.sf.hibernate.transaction.JTATransaction] commit
In the database we don't see any change. Later, the MDB tries to saveOrUpdate an object in one of the deleted tables and it seems to produce a deadlock... It's very strange, we don't know what can be happening. Has anyone experienced something similar ??
We need some help here, the faqs and examples didn't help in this case.
Regards,
Gerald.