Search in sources :

Example 26 with Queryable

use of org.hibernate.persister.entity.Queryable in project hibernate-orm by hibernate.

the class QueryTranslatorImpl method getEntityPersisterForName.

private Queryable getEntityPersisterForName(String name) throws QueryException {
    String type = getType(name);
    Queryable persister = getEntityPersister(type);
    if (persister == null) {
        throw new QueryException("persistent class not found: " + type);
    }
    return persister;
}
Also used : QueryException(org.hibernate.QueryException) Queryable(org.hibernate.persister.entity.Queryable)

Example 27 with Queryable

use of org.hibernate.persister.entity.Queryable in project hibernate-orm by hibernate.

the class QueryTranslatorImpl method getPropertyMapping.

PropertyMapping getPropertyMapping(String name) throws QueryException {
    PropertyMapping decorator = getDecoratedPropertyMapping(name);
    if (decorator != null) {
        return decorator;
    }
    String type = getType(name);
    if (type == null) {
        String role = getRole(name);
        if (role == null) {
            throw new QueryException("alias not found: " + name);
        }
        //.getElementPropertyMapping();
        return getCollectionPersister(role);
    } else {
        Queryable persister = getEntityPersister(type);
        if (persister == null) {
            throw new QueryException("persistent class not found: " + type);
        }
        return persister;
    }
}
Also used : QueryException(org.hibernate.QueryException) Queryable(org.hibernate.persister.entity.Queryable) PropertyMapping(org.hibernate.persister.entity.PropertyMapping)

Example 28 with Queryable

use of org.hibernate.persister.entity.Queryable 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 29 with Queryable

use of org.hibernate.persister.entity.Queryable 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 30 with Queryable

use of org.hibernate.persister.entity.Queryable 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

Queryable (org.hibernate.persister.entity.Queryable)34 QueryException (org.hibernate.QueryException)10 FromElement (org.hibernate.hql.internal.ast.tree.FromElement)8 Type (org.hibernate.type.Type)7 CollectionType (org.hibernate.type.CollectionType)5 EntityType (org.hibernate.type.EntityType)5 SharedSessionContractImplementor (org.hibernate.engine.spi.SharedSessionContractImplementor)4 UpdateStatement (org.hibernate.hql.internal.ast.tree.UpdateStatement)4 DeleteStatement (org.hibernate.hql.internal.ast.tree.DeleteStatement)3 QueryableCollection (org.hibernate.persister.collection.QueryableCollection)3 EntityPersister (org.hibernate.persister.entity.EntityPersister)3 JoinType (org.hibernate.sql.JoinType)3 AST (antlr.collections.AST)2 InsertStatement (org.hibernate.hql.internal.ast.tree.InsertStatement)2 ParameterNode (org.hibernate.hql.internal.ast.tree.ParameterNode)2 TableBasedDeleteHandlerImpl (org.hibernate.hql.spi.id.TableBasedDeleteHandlerImpl)2 TableBasedUpdateHandlerImpl (org.hibernate.hql.spi.id.TableBasedUpdateHandlerImpl)2 CollectionFilterKeyParameterSpecification (org.hibernate.param.CollectionFilterKeyParameterSpecification)2 NamedParameterSpecification (org.hibernate.param.NamedParameterSpecification)2 ParameterSpecification (org.hibernate.param.ParameterSpecification)2