Search in sources :

Example 1 with DeleteStatement

use of org.hibernate.hql.internal.ast.tree.DeleteStatement in project hibernate-orm by hibernate.

the class LocalTemporaryTableBulkIdStrategy method buildDeleteHandler.

@Override
public DeleteHandler buildDeleteHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) {
    final DeleteStatement updateStatement = (DeleteStatement) walker.getAST();
    final FromElement fromElement = updateStatement.getFromClause().getFromElement();
    final Queryable targetedPersister = fromElement.getQueryable();
    final IdTableInfoImpl tableInfo = getIdTableInfo(targetedPersister);
    return new TableBasedDeleteHandlerImpl(factory, walker, tableInfo) {

        @Override
        protected void prepareForUse(Queryable persister, SharedSessionContractImplementor session) {
            Helper.INSTANCE.createTempTable(tableInfo, ddlTransactionHandling, session);
        }

        @Override
        protected void releaseFromUse(Queryable persister, SharedSessionContractImplementor session) {
            Helper.INSTANCE.releaseTempTable(tableInfo, afterUseAction, ddlTransactionHandling, session);
        }
    };
}
Also used : TableBasedDeleteHandlerImpl(org.hibernate.hql.spi.id.TableBasedDeleteHandlerImpl) FromElement(org.hibernate.hql.internal.ast.tree.FromElement) Queryable(org.hibernate.persister.entity.Queryable) SharedSessionContractImplementor(org.hibernate.engine.spi.SharedSessionContractImplementor) DeleteStatement(org.hibernate.hql.internal.ast.tree.DeleteStatement)

Example 2 with DeleteStatement

use of org.hibernate.hql.internal.ast.tree.DeleteStatement in project hibernate-orm by hibernate.

the class PersistentTableBulkIdStrategy method buildDeleteHandler.

@Override
public DeleteHandler buildDeleteHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) {
    final DeleteStatement updateStatement = (DeleteStatement) walker.getAST();
    final FromElement fromElement = updateStatement.getFromClause().getFromElement();
    final Queryable targetedPersister = fromElement.getQueryable();
    return new DeleteHandlerImpl(factory, walker, getIdTableInfo(targetedPersister));
}
Also used : FromElement(org.hibernate.hql.internal.ast.tree.FromElement) Queryable(org.hibernate.persister.entity.Queryable) DeleteStatement(org.hibernate.hql.internal.ast.tree.DeleteStatement)

Example 3 with DeleteStatement

use of org.hibernate.hql.internal.ast.tree.DeleteStatement in project hibernate-orm by hibernate.

the class GlobalTemporaryTableBulkIdStrategy method buildDeleteHandler.

@Override
public DeleteHandler buildDeleteHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) {
    final DeleteStatement updateStatement = (DeleteStatement) walker.getAST();
    final FromElement fromElement = updateStatement.getFromClause().getFromElement();
    final Queryable targetedPersister = fromElement.getQueryable();
    return new TableBasedDeleteHandlerImpl(factory, walker, getIdTableInfo(targetedPersister)) {

        @Override
        protected void releaseFromUse(Queryable persister, SharedSessionContractImplementor session) {
            if (afterUseAction == AfterUseAction.NONE) {
                return;
            }
            // clean up our id-table rows
            cleanUpRows(getIdTableInfo(persister).getQualifiedIdTableName(), session);
        }
    };
}
Also used : TableBasedDeleteHandlerImpl(org.hibernate.hql.spi.id.TableBasedDeleteHandlerImpl) FromElement(org.hibernate.hql.internal.ast.tree.FromElement) Queryable(org.hibernate.persister.entity.Queryable) SharedSessionContractImplementor(org.hibernate.engine.spi.SharedSessionContractImplementor) DeleteStatement(org.hibernate.hql.internal.ast.tree.DeleteStatement)

Aggregations

DeleteStatement (org.hibernate.hql.internal.ast.tree.DeleteStatement)3 FromElement (org.hibernate.hql.internal.ast.tree.FromElement)3 Queryable (org.hibernate.persister.entity.Queryable)3 SharedSessionContractImplementor (org.hibernate.engine.spi.SharedSessionContractImplementor)2 TableBasedDeleteHandlerImpl (org.hibernate.hql.spi.id.TableBasedDeleteHandlerImpl)2