Search in sources :

Example 1 with AliasGenerator

use of org.hibernate.sql.AliasGenerator in project hibernate-orm by hibernate.

the class MapEntryNode method determineValueSelectExpressions.

private void determineValueSelectExpressions(QueryableCollection collectionPersister, List selections) {
    AliasGenerator aliasGenerator = new LocalAliasGenerator(1);
    appendSelectExpressions(collectionPersister.getElementColumnNames(), selections, aliasGenerator);
    Type valueType = collectionPersister.getElementType();
    if (valueType.isAssociationType()) {
        EntityType valueEntityType = (EntityType) valueType;
        Queryable valueEntityPersister = (Queryable) sfi().getEntityPersister(valueEntityType.getAssociatedEntityName(sfi()));
        SelectFragment fragment = valueEntityPersister.propertySelectFragmentFragment(elementTableAlias(), null, false);
        appendSelectExpressions(fragment, selections, aliasGenerator);
    }
}
Also used : EntityType(org.hibernate.type.EntityType) SelectFragment(org.hibernate.sql.SelectFragment) EntityType(org.hibernate.type.EntityType) Type(org.hibernate.type.Type) AliasGenerator(org.hibernate.sql.AliasGenerator) Queryable(org.hibernate.persister.entity.Queryable)

Example 2 with AliasGenerator

use of org.hibernate.sql.AliasGenerator in project hibernate-orm by hibernate.

the class MapEntryNode method determineKeySelectExpressions.

private void determineKeySelectExpressions(QueryableCollection collectionPersister, List selections) {
    AliasGenerator aliasGenerator = new LocalAliasGenerator(0);
    appendSelectExpressions(collectionPersister.getIndexColumnNames(), selections, aliasGenerator);
    Type keyType = collectionPersister.getIndexType();
    if (keyType.isEntityType()) {
        MapKeyEntityFromElement mapKeyEntityFromElement = findOrAddMapKeyEntityFromElement(collectionPersister);
        Queryable keyEntityPersister = mapKeyEntityFromElement.getQueryable();
        SelectFragment fragment = keyEntityPersister.propertySelectFragmentFragment(mapKeyEntityFromElement.getTableAlias(), null, false);
        appendSelectExpressions(fragment, selections, aliasGenerator);
    }
}
Also used : SelectFragment(org.hibernate.sql.SelectFragment) EntityType(org.hibernate.type.EntityType) Type(org.hibernate.type.Type) AliasGenerator(org.hibernate.sql.AliasGenerator) Queryable(org.hibernate.persister.entity.Queryable)

Aggregations

Queryable (org.hibernate.persister.entity.Queryable)2 AliasGenerator (org.hibernate.sql.AliasGenerator)2 SelectFragment (org.hibernate.sql.SelectFragment)2 EntityType (org.hibernate.type.EntityType)2 Type (org.hibernate.type.Type)2