/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.query.sqm.tree.expression.domain;
import org.hibernate.persister.common.spi.Navigable;
import org.hibernate.query.sqm.domain.SqmExpressableTypeEntity;
import org.hibernate.query.sqm.domain.SqmPluralAttributeIndexEntity;
import org.hibernate.query.sqm.tree.from.SqmFrom;
import org.jboss.logging.Logger;
/**
* @author Steve Ebersole
*/
public class SqmCollectionIndexReferenceEntity
extends AbstractSqmCollectionIndexReference
implements SqmNavigableSourceReference, SqmEntityTypedReference {
private static final Logger log = Logger.getLogger( SqmCollectionIndexReferenceEntity.class );
private SqmFrom exportedFromElement;
public SqmCollectionIndexReferenceEntity(SqmPluralAttributeReference pluralAttributeBinding) {
super( pluralAttributeBinding );
}
@Override
public SqmExpressableTypeEntity getExpressionType() {
return getReferencedNavigable();
}
@Override
public Navigable getReferencedNavigable() {
return (SqmPluralAttributeIndexEntity) getPluralAttributeBinding().getReferencedNavigable().getIndexDescriptor();
}
@Override
public SqmExpressableTypeEntity getInferableType() {
return getExpressionType();
}
@Override
public SqmFrom getExportedFromElement() {
return exportedFromElement;
}
@Override
public void injectExportedFromElement(SqmFrom sqmFrom) {
log.debugf(
"Injecting SqmFrom [%s] into CollectionElementBindingEntity [%s], was [%s]",
sqmFrom,
this,
this.exportedFromElement
);
exportedFromElement = sqmFrom;
}
}