Search in sources :

Example 1 with TableBasedDeleteHandlerImpl

use of org.hibernate.hql.spi.id.TableBasedDeleteHandlerImpl 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 TableBasedDeleteHandlerImpl

use of org.hibernate.hql.spi.id.TableBasedDeleteHandlerImpl 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

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