All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.query.sqm.tree.domain.SqmCorrelatedRoot Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha2
Show newest version
/*
 * 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 );
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy