use of org.hibernate.persister.entity.Queryable in project hibernate-orm by hibernate.
the class HqlSqlWalker method createIntoClause.
@Override
protected AST createIntoClause(String path, AST propertySpec) throws SemanticException {
Queryable persister = (Queryable) getSessionFactoryHelper().requireClassPersister(path);
IntoClause intoClause = (IntoClause) getASTFactory().create(INTO, persister.getEntityName());
intoClause.setFirstChild(propertySpec);
intoClause.initialize(persister);
addQuerySpaces(persister.getQuerySpaces());
return intoClause;
}
use of org.hibernate.persister.entity.Queryable in project hibernate-orm by hibernate.
the class FromElement method handlePropertyBeingDereferenced.
public void handlePropertyBeingDereferenced(Type propertySource, String propertyName) {
if (getQueryableCollection() != null && CollectionProperties.isCollectionProperty(propertyName)) {
// propertyName refers to something like collection.size...
return;
}
if (propertySource.isComponentType()) {
// property name is a sub-path of a component...
return;
}
Queryable persister = getQueryable();
if (persister != null) {
try {
Queryable.Declarer propertyDeclarer = persister.getSubclassPropertyDeclarer(propertyName);
if (LOG.isTraceEnabled()) {
LOG.tracev("Handling property dereference [{0} ({1}) -> {2} ({3})]", persister.getEntityName(), getClassAlias(), propertyName, propertyDeclarer);
}
if (propertyDeclarer == Queryable.Declarer.SUBCLASS) {
dereferencedBySubclassProperty = true;
includeSubclasses = true;
} else if (propertyDeclarer == Queryable.Declarer.SUPERCLASS) {
dereferencedBySuperclassProperty = true;
}
} catch (QueryException ignore) {
// ignore it; the incoming property could not be found so we
// cannot be sure what to do here. At the very least, the
// safest is to simply not apply any dereference toggling...
}
}
}
use of org.hibernate.persister.entity.Queryable in project hibernate-orm by hibernate.
the class FromElementFactory method addFromElement.
FromElement addFromElement() throws SemanticException {
final FromClause parentFromClause = fromClause.getParentFromClause();
if (parentFromClause != null) {
// Look up class name using the first identifier in the path.
final String pathAlias = PathHelper.getAlias(path);
final FromElement parentFromElement = parentFromClause.getFromElement(pathAlias);
if (parentFromElement != null) {
return createFromElementInSubselect(path, pathAlias, parentFromElement, classAlias);
}
}
final EntityPersister entityPersister = fromClause.getSessionFactoryHelper().requireClassPersister(path);
final FromElement elem = createAndAddFromElement(path, classAlias, entityPersister, (EntityType) ((Queryable) entityPersister).getType(), null);
// Add to the query spaces.
fromClause.getWalker().addQuerySpaces(entityPersister.getQuerySpaces());
return elem;
}
use of org.hibernate.persister.entity.Queryable 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);
}
};
}
use of org.hibernate.persister.entity.Queryable in project hibernate-orm by hibernate.
the class PersistentTableBulkIdStrategy 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 UpdateHandlerImpl(factory, walker, getIdTableInfo(targetedPersister));
}
Aggregations