Search in sources :

Example 1 with TableBasedUpdateHandlerImpl

use of org.hibernate.hql.spi.id.TableBasedUpdateHandlerImpl in project hibernate-orm by hibernate.

the class LocalTemporaryTableBulkIdStrategy method buildUpdateHandler.

@Override
public UpdateHandler buildUpdateHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) {
    final UpdateStatement updateStatement = (UpdateStatement) walker.getAST();
    final FromElement fromElement = updateStatement.getFromClause().getFromElement();
    final Queryable targetedPersister = fromElement.getQueryable();
    final IdTableInfoImpl tableInfo = getIdTableInfo(targetedPersister);
    return new TableBasedUpdateHandlerImpl(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 : UpdateStatement(org.hibernate.hql.internal.ast.tree.UpdateStatement) FromElement(org.hibernate.hql.internal.ast.tree.FromElement) Queryable(org.hibernate.persister.entity.Queryable) SharedSessionContractImplementor(org.hibernate.engine.spi.SharedSessionContractImplementor) TableBasedUpdateHandlerImpl(org.hibernate.hql.spi.id.TableBasedUpdateHandlerImpl)

Example 2 with TableBasedUpdateHandlerImpl

use of org.hibernate.hql.spi.id.TableBasedUpdateHandlerImpl in project hibernate-orm by hibernate.

the class GlobalTemporaryTableBulkIdStrategy method buildUpdateHandler.

@Override
public UpdateHandler buildUpdateHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) {
    final UpdateStatement updateStatement = (UpdateStatement) walker.getAST();
    final FromElement fromElement = updateStatement.getFromClause().getFromElement();
    final Queryable targetedPersister = fromElement.getQueryable();
    return new TableBasedUpdateHandlerImpl(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 : UpdateStatement(org.hibernate.hql.internal.ast.tree.UpdateStatement) FromElement(org.hibernate.hql.internal.ast.tree.FromElement) Queryable(org.hibernate.persister.entity.Queryable) SharedSessionContractImplementor(org.hibernate.engine.spi.SharedSessionContractImplementor) TableBasedUpdateHandlerImpl(org.hibernate.hql.spi.id.TableBasedUpdateHandlerImpl)

Aggregations

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