org.hibernate.query.sqm.tree.domain.SqmCorrelatedRoot Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* 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.domain;
import org.hibernate.query.criteria.JpaSelection;
import org.hibernate.query.sqm.SemanticQueryWalker;
import org.hibernate.query.sqm.tree.from.SqmRoot;
/**
* @author Steve Ebersole
*/
public class SqmCorrelatedRoot extends SqmRoot implements SqmPathWrapper, SqmCorrelation {
private final SqmRoot correlationParent;
public SqmCorrelatedRoot(SqmRoot correlationParent) {
super(
correlationParent.getNavigablePath(),
correlationParent.getReferencedPathSource(),
null,
correlationParent.nodeBuilder()
);
this.correlationParent = correlationParent;
}
@Override
public SqmRoot getCorrelationParent() {
return correlationParent;
}
@Override
public SqmPath getWrappedPath() {
return getCorrelationParent();
}
@Override
public String getExplicitAlias() {
return correlationParent.getExplicitAlias();
}
@Override
public void setExplicitAlias(String explicitAlias) {
throw new UnsupportedOperationException( "Can't set alias on a correlated root" );
}
@Override
public JpaSelection alias(String name) {
setAlias( name );
return this;
}
@Override
public boolean isCorrelated() {
return true;
}
@Override
public SqmRoot getCorrelatedRoot() {
return this;
}
@Override
public X accept(SemanticQueryWalker walker) {
return walker.visitCorrelation( this );
}
}