I am using Hibernate to delete an object that has two cascade levels, and my problem is that it is VERY slow when I query for the objects and then delete and I am interested in seeing if there is a faster way. My code, which takes about 15-30 seconds to delete 15 Statement objects looks like this:

public void deleteStatement(Long batchId) {
    List<Statement> statements = session.createQuery("from Statement where batchId = ?").setParameter(0, batchId).list();
    for(Statement statement : statements) {
        session.delete(statement);
        logger.debug("Deleted statement");
    }
}

I know I could just do:

session.createQuery("delete from Statement where batchId = ?").setParameter(0, batchId).executeUpdate();

but the problem is that the delete cascades do not occur with this method. Is there an efficient way to delete my objects and still have the cascade occur, or is there something I'm doing wrong?

Thanks for the help!

Update
In response to davidfrancis, here's a paraphrase of the SQL that hibernate generates. It's crazy and thousands of lines long, believe it or not!! Note, my domain object, Statement, contains set of Invoice, which contains set of Transaction. I am lazy loading all of my collections, btw. First there's a lot of data retrieval, which, I believe happens with the HQL select query:

org.hibernate.hql.ast.QueryTranslatorImpl - HQL: from com.myapp.domain.cc.Statement where batchId = ?
org.hibernate.hql.ast.QueryTranslatorImpl - SQL: select statement0_.id as id2_, statement0_.batchId as batchId2_ from statement statement0_ where batchId=?
org.hibernate.loader.Loader - result row: EntityKey[com.myapp.domain.cc.Statement#393]
org.hibernate.loader.Loader - result row: EntityKey[com.myapp.domain.cc.Statement#394]
...
org.hibernate.SQL - select invoices0_.statementId as stateme12_2_1_, invoices0_.id as id1_, inv
Edit
Report