HHH-15944 Joins on non-managed-type polymorphisms don't work
This commit is contained in:
parent
ab7d05c150
commit
bea5bfbe89
|
@ -22,10 +22,31 @@ import org.hibernate.query.criteria.JpaSearchOrder;
|
|||
import org.hibernate.query.sqm.tree.SqmQuery;
|
||||
import org.hibernate.query.sqm.tree.cte.SqmCteTableColumn;
|
||||
import org.hibernate.query.sqm.tree.cte.SqmSearchClauseSpecification;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmBagJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedBagJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedCrossJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedEntityJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedListJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedMapJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedPluralPartJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedRoot;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedRootJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedSetJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedSingularJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCteRoot;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmDerivedRoot;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmListJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmMapJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmSetJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmSingularJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmTreatedPath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmTreatedRoot;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmTreatedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmAny;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmEvery;
|
||||
import org.hibernate.query.sqm.tree.from.SqmCteJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmDerivedJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmJoin;
|
||||
import org.hibernate.query.sqm.tree.select.SqmSelectQuery;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.query.hql.spi.SqmCreationOptions;
|
||||
|
@ -54,7 +75,6 @@ import org.hibernate.query.sqm.tree.expression.SqmLiteralEntityType;
|
|||
import org.hibernate.query.sqm.tree.expression.SqmNamedParameter;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmPositionalParameter;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmUnaryOperation;
|
||||
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmCrossJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmEntityJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
|
@ -190,8 +210,8 @@ public class QuerySplitter {
|
|||
private final SqmCreationContext creationContext;
|
||||
private final Stack<SqmCreationProcessingState> processingStateStack = new StandardStack<>( SqmCreationProcessingState.class );
|
||||
|
||||
private Map<NavigablePath, SqmPath> sqmPathCopyMap = new HashMap<>();
|
||||
private Map<SqmFrom, SqmFrom> sqmFromCopyMap = new HashMap<>();
|
||||
private final Map<NavigablePath, SqmPath> sqmPathCopyMap = new HashMap<>();
|
||||
private final Map<SqmFrom, SqmFrom> sqmFromCopyMap = new HashMap<>();
|
||||
|
||||
private UnmappedPolymorphismReplacer(
|
||||
SqmRoot unmappedPolymorphicFromElement,
|
||||
|
@ -598,16 +618,28 @@ public class QuerySplitter {
|
|||
if ( sqmFrom != null ) {
|
||||
return (SqmCrossJoin<?>) sqmFrom;
|
||||
}
|
||||
final SqmRoot<?> sqmRoot = (SqmRoot<?>) sqmFromCopyMap.get( join.findRoot() );
|
||||
final SqmCrossJoin copy = new SqmCrossJoin<>(
|
||||
join.getReferencedPathSource(),
|
||||
join.getExplicitAlias(),
|
||||
sqmRoot
|
||||
(SqmRoot<?>) sqmFromCopyMap.get( join.findRoot() )
|
||||
);
|
||||
getProcessingStateStack().getCurrent().getPathRegistry().register( copy );
|
||||
sqmFromCopyMap.put( join, copy );
|
||||
sqmPathCopyMap.put( join.getNavigablePath(), copy );
|
||||
sqmRoot.addSqmJoin( copy );
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmCorrelatedCrossJoin<?> visitCorrelatedCrossJoin(SqmCorrelatedCrossJoin<?> join) {
|
||||
final SqmFrom<?, ?> sqmFrom = sqmFromCopyMap.get( join );
|
||||
if ( sqmFrom != null ) {
|
||||
return (SqmCorrelatedCrossJoin<?>) sqmFrom;
|
||||
}
|
||||
|
||||
final SqmCorrelatedCrossJoin copy = new SqmCorrelatedCrossJoin<>(
|
||||
findSqmFromCopy( join.getCorrelationParent() )
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
@ -617,18 +649,29 @@ public class QuerySplitter {
|
|||
if ( sqmFrom != null ) {
|
||||
return (SqmPluralPartJoin<?, ?>) sqmFrom;
|
||||
}
|
||||
final SqmFrom<?, ?> newLhs = (SqmFrom<?, ?>) sqmFromCopyMap.get( join.getLhs() );
|
||||
final SqmPluralPartJoin copy = new SqmPluralPartJoin<>(
|
||||
newLhs,
|
||||
(SqmFrom<?, ?>) sqmFromCopyMap.get( join.getLhs() ),
|
||||
join.getReferencedPathSource(),
|
||||
join.getExplicitAlias(),
|
||||
join.getSqmJoinType(),
|
||||
join.nodeBuilder()
|
||||
);
|
||||
getProcessingStateStack().getCurrent().getPathRegistry().register( copy );
|
||||
sqmFromCopyMap.put( join, copy );
|
||||
sqmPathCopyMap.put( join.getNavigablePath(), copy );
|
||||
newLhs.addSqmJoin( copy );
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmCorrelatedPluralPartJoin<?,?> visitCorrelatedPluralPartJoin(SqmCorrelatedPluralPartJoin<?, ?> join) {
|
||||
final SqmFrom<?, ?> sqmFrom = sqmFromCopyMap.get( join );
|
||||
if ( sqmFrom != null ) {
|
||||
return (SqmCorrelatedPluralPartJoin<?, ?>) sqmFrom;
|
||||
}
|
||||
final SqmCorrelatedPluralPartJoin copy = new SqmCorrelatedPluralPartJoin<>(
|
||||
findSqmFromCopy( join.getCorrelationParent() )
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
@ -645,24 +688,235 @@ public class QuerySplitter {
|
|||
join.getSqmJoinType(),
|
||||
sqmRoot
|
||||
);
|
||||
getProcessingStateStack().getCurrent().getPathRegistry().register( copy );
|
||||
sqmFromCopyMap.put( join, copy );
|
||||
sqmPathCopyMap.put( join.getNavigablePath(), copy );
|
||||
sqmRoot.addSqmJoin( copy );
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmAttributeJoin<?, ?> visitQualifiedAttributeJoin(SqmAttributeJoin<?, ?> join) {
|
||||
SqmFrom<?, ?> sqmFrom = sqmFromCopyMap.get( join );
|
||||
public SqmCorrelatedRootJoin<?> visitCorrelatedRootJoin(SqmCorrelatedRootJoin<?> correlatedRootJoin) {
|
||||
final SqmCorrelatedRootJoin<?> sqmFrom = (SqmCorrelatedRootJoin<?>) sqmFromCopyMap.get( correlatedRootJoin );
|
||||
if ( sqmFrom != null ) {
|
||||
return (SqmAttributeJoin<?, ?>) sqmFrom;
|
||||
return sqmFrom;
|
||||
}
|
||||
SqmAttributeJoin copy = join.makeCopy( getProcessingStateStack().getCurrent() );
|
||||
getProcessingStateStack().getCurrent().getPathRegistry().register( copy );
|
||||
sqmFromCopyMap.put( join, copy );
|
||||
sqmPathCopyMap.put( join.getNavigablePath(), copy );
|
||||
( (SqmFrom<?, ?>) copy.getParent() ).addSqmJoin( copy );
|
||||
SqmCorrelatedRootJoin<?> copy = new SqmCorrelatedRootJoin<>(
|
||||
correlatedRootJoin.getNavigablePath(),
|
||||
correlatedRootJoin.getReferencedPathSource(),
|
||||
correlatedRootJoin.nodeBuilder()
|
||||
);
|
||||
correlatedRootJoin.visitReusablePaths( path -> path.accept( this ) );
|
||||
|
||||
sqmFromCopyMap.put( correlatedRootJoin, copy );
|
||||
sqmPathCopyMap.put( correlatedRootJoin.getNavigablePath(), copy );
|
||||
correlatedRootJoin.visitSqmJoins(
|
||||
sqmJoin ->
|
||||
sqmJoin.accept( this )
|
||||
);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmCorrelatedRoot<?> visitCorrelatedRoot(SqmCorrelatedRoot<?> correlatedRoot) {
|
||||
final SqmCorrelatedRoot<?> sqmFrom = (SqmCorrelatedRoot<?>) sqmFromCopyMap.get( correlatedRoot );
|
||||
if ( sqmFrom != null ) {
|
||||
return sqmFrom;
|
||||
}
|
||||
SqmCorrelatedRoot<?> copy = new SqmCorrelatedRoot<>(
|
||||
findSqmFromCopy( correlatedRoot.getCorrelationParent() )
|
||||
);
|
||||
|
||||
correlatedRoot.visitReusablePaths( path -> path.accept( this ) );
|
||||
|
||||
sqmFromCopyMap.put( correlatedRoot, copy );
|
||||
sqmPathCopyMap.put( correlatedRoot.getNavigablePath(), copy );
|
||||
correlatedRoot.visitSqmJoins(
|
||||
sqmJoin ->
|
||||
sqmJoin.accept( this )
|
||||
);
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmBagJoin<?, ?> visitBagJoin(SqmBagJoin<?, ?> join) {
|
||||
final SqmFrom<?, ?> existing = sqmFromCopyMap.get( join );
|
||||
if ( existing != null ) {
|
||||
return (SqmBagJoin<?, ?>) existing;
|
||||
}
|
||||
|
||||
final SqmBagJoin copy = new SqmBagJoin<>(
|
||||
findSqmFromCopy( join.getLhs() ),
|
||||
join.getReferencedPathSource(),
|
||||
join.getExplicitAlias(),
|
||||
join.getSqmJoinType(),
|
||||
join.isFetched(),
|
||||
join.nodeBuilder()
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmCorrelatedBagJoin<?, ?> visitCorrelatedBagJoin(SqmCorrelatedBagJoin<?, ?> join) {
|
||||
final SqmFrom<?, ?> existing = sqmFromCopyMap.get( join );
|
||||
if ( existing != null ) {
|
||||
return (SqmCorrelatedBagJoin<?, ?>) existing;
|
||||
}
|
||||
|
||||
final SqmCorrelatedBagJoin copy = new SqmCorrelatedBagJoin<>(
|
||||
findSqmFromCopy( join.getCorrelationParent() )
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmCorrelatedListJoin<?, ?> visitCorrelatedListJoin(SqmCorrelatedListJoin<?, ?> join) {
|
||||
final SqmFrom<?, ?> existing = sqmFromCopyMap.get( join );
|
||||
|
||||
if ( existing != null ) {
|
||||
return (SqmCorrelatedListJoin<?, ?>) existing;
|
||||
}
|
||||
|
||||
final SqmCorrelatedListJoin copy = new SqmCorrelatedListJoin<>(
|
||||
findSqmFromCopy( join.getCorrelationParent() )
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmCorrelatedMapJoin<?, ?, ?> visitCorrelatedMapJoin(SqmCorrelatedMapJoin<?, ?, ?> join) {
|
||||
final SqmFrom<?, ?> existing = sqmFromCopyMap.get( join );
|
||||
|
||||
if ( existing != null ) {
|
||||
return (SqmCorrelatedMapJoin<?, ?, ?>) existing;
|
||||
}
|
||||
|
||||
final SqmCorrelatedMapJoin copy = new SqmCorrelatedMapJoin<>(
|
||||
findSqmFromCopy( join.getCorrelationParent() )
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmCorrelatedSetJoin<?, ?> visitCorrelatedSetJoin(SqmCorrelatedSetJoin<?, ?> join) {
|
||||
final SqmFrom<?, ?> existing = sqmFromCopyMap.get( join );
|
||||
|
||||
if ( existing != null ) {
|
||||
return (SqmCorrelatedSetJoin<?, ?>) existing;
|
||||
}
|
||||
|
||||
final SqmCorrelatedSetJoin copy = new SqmCorrelatedSetJoin<>(
|
||||
findSqmFromCopy( join.getCorrelationParent() )
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmCorrelatedSingularJoin<?, ?> visitCorrelatedSingularJoin(SqmCorrelatedSingularJoin<?, ?> join) {
|
||||
final SqmFrom<?, ?> existing = sqmFromCopyMap.get( join );
|
||||
|
||||
if ( existing != null ) {
|
||||
return (SqmCorrelatedSingularJoin<?, ?>) existing;
|
||||
}
|
||||
|
||||
final SqmCorrelatedSingularJoin copy = new SqmCorrelatedSingularJoin<>(
|
||||
findSqmFromCopy( join.getCorrelationParent() )
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmListJoin<?, ?> visitListJoin(SqmListJoin<?, ?> join) {
|
||||
final SqmFrom<?, ?> existing = sqmFromCopyMap.get( join );
|
||||
|
||||
if ( existing != null ) {
|
||||
return (SqmListJoin<?, ?>) existing;
|
||||
}
|
||||
|
||||
final SqmListJoin copy = new SqmListJoin<>(
|
||||
findSqmFromCopy( join.getLhs() ),
|
||||
join.getReferencedPathSource(),
|
||||
join.getExplicitAlias(),
|
||||
join.getSqmJoinType(),
|
||||
join.isFetched(),
|
||||
join.nodeBuilder()
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmMapJoin<?, ?, ?> visitMapJoin(SqmMapJoin<?, ?, ?> join) {
|
||||
final SqmFrom<?, ?> existing = sqmFromCopyMap.get( join );
|
||||
|
||||
if ( existing != null ) {
|
||||
return (SqmMapJoin<?, ?, ?>) existing;
|
||||
}
|
||||
|
||||
final SqmMapJoin copy = new SqmMapJoin<>(
|
||||
findSqmFromCopy( join.getLhs() ),
|
||||
join.getReferencedPathSource(),
|
||||
join.getExplicitAlias(),
|
||||
join.getSqmJoinType(),
|
||||
join.isFetched(),
|
||||
join.nodeBuilder()
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmSetJoin<?, ?> visitSetJoin(SqmSetJoin<?, ?> join) {
|
||||
final SqmFrom<?, ?> existing = sqmFromCopyMap.get( join );
|
||||
|
||||
if ( existing != null ) {
|
||||
return (SqmSetJoin<?, ?>) existing;
|
||||
}
|
||||
|
||||
final SqmSetJoin copy = new SqmSetJoin<>(
|
||||
findSqmFromCopy( join.getLhs() ),
|
||||
join.getReferencedPathSource(),
|
||||
join.getExplicitAlias(),
|
||||
join.getSqmJoinType(),
|
||||
join.isFetched(),
|
||||
join.nodeBuilder()
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmSingularJoin<?, ?> visitSingularJoin(SqmSingularJoin<?, ?> join) {
|
||||
final SqmFrom<?, ?> existing = sqmFromCopyMap.get( join );
|
||||
|
||||
if ( existing != null ) {
|
||||
return (SqmSingularJoin<?, ?>) existing;
|
||||
}
|
||||
|
||||
final SqmSingularJoin copy = new SqmSingularJoin<>(
|
||||
findSqmFromCopy( join.getLhs() ),
|
||||
join.getReferencedPathSource(),
|
||||
join.getExplicitAlias(),
|
||||
join.getSqmJoinType(),
|
||||
join.isFetched(),
|
||||
join.nodeBuilder()
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
@ -680,10 +934,23 @@ public class QuerySplitter {
|
|||
join.isLateral(),
|
||||
sqmRoot
|
||||
);
|
||||
getProcessingStateStack().getCurrent().getPathRegistry().register( copy );
|
||||
sqmFromCopyMap.put( join, copy );
|
||||
sqmPathCopyMap.put( join.getNavigablePath(), copy );
|
||||
sqmRoot.addSqmJoin( copy );
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmCorrelatedEntityJoin<?> visitCorrelatedEntityJoin(SqmCorrelatedEntityJoin<?> join) {
|
||||
SqmFrom<?, ?> sqmFrom = sqmFromCopyMap.get( join );
|
||||
if ( sqmFrom != null ) {
|
||||
return (SqmCorrelatedEntityJoin<?>) sqmFrom;
|
||||
}
|
||||
|
||||
final SqmCorrelatedEntityJoin copy = new SqmCorrelatedEntityJoin(
|
||||
findSqmFromCopy( join.getCorrelationParent() )
|
||||
);
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
@ -700,10 +967,8 @@ public class QuerySplitter {
|
|||
join.getSqmJoinType(),
|
||||
sqmRoot
|
||||
);
|
||||
getProcessingStateStack().getCurrent().getPathRegistry().register( copy );
|
||||
sqmFromCopyMap.put( join, copy );
|
||||
sqmPathCopyMap.put( join.getNavigablePath(), copy );
|
||||
sqmRoot.addSqmJoin( copy );
|
||||
|
||||
visitJoins( join, copy );
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
@ -711,7 +976,7 @@ public class QuerySplitter {
|
|||
public SqmBasicValuedSimplePath<?> visitBasicValuedPath(SqmBasicValuedSimplePath<?> path) {
|
||||
final SqmPathRegistry pathRegistry = getProcessingStateStack().getCurrent().getPathRegistry();
|
||||
|
||||
final SqmPath<?> lhs = findLhs( path, pathRegistry );
|
||||
final SqmPath<?> lhs = findLhs( path );
|
||||
|
||||
final SqmBasicValuedSimplePath<?> copy = new SqmBasicValuedSimplePath<>(
|
||||
lhs.getNavigablePath().append( path.getNavigablePath().getLocalName() ),
|
||||
|
@ -728,7 +993,7 @@ public class QuerySplitter {
|
|||
@Override
|
||||
public SqmEmbeddedValuedSimplePath<?> visitEmbeddableValuedPath(SqmEmbeddedValuedSimplePath<?> path) {
|
||||
final SqmPathRegistry pathRegistry = getProcessingStateStack().getCurrent().getPathRegistry();
|
||||
final SqmPath<?> lhs = findLhs( path, pathRegistry );
|
||||
final SqmPath<?> lhs = findLhs( path );
|
||||
final SqmEmbeddedValuedSimplePath<?> copy = new SqmEmbeddedValuedSimplePath<>(
|
||||
lhs.getNavigablePath().append( path.getNavigablePath().getLocalName() ),
|
||||
path.getReferencedPathSource(),
|
||||
|
@ -743,7 +1008,7 @@ public class QuerySplitter {
|
|||
@Override
|
||||
public SqmEntityValuedSimplePath<?> visitEntityValuedPath(SqmEntityValuedSimplePath<?> path) {
|
||||
final SqmPathRegistry pathRegistry = getProcessingStateStack().getCurrent().getPathRegistry();
|
||||
final SqmPath<?> lhs = findLhs( path, pathRegistry );
|
||||
final SqmPath<?> lhs = findLhs( path );
|
||||
final SqmEntityValuedSimplePath<?> copy = new SqmEntityValuedSimplePath<>(
|
||||
lhs.getNavigablePath().append( path.getNavigablePath().getLocalName() ),
|
||||
path.getReferencedPathSource(),
|
||||
|
@ -758,7 +1023,7 @@ public class QuerySplitter {
|
|||
@Override
|
||||
public SqmPluralValuedSimplePath<?> visitPluralValuedPath(SqmPluralValuedSimplePath<?> path) {
|
||||
final SqmPathRegistry pathRegistry = getProcessingStateStack().getCurrent().getPathRegistry();
|
||||
SqmPath<?> lhs = findLhs( path, pathRegistry );
|
||||
SqmPath<?> lhs = findLhs( path );
|
||||
|
||||
final SqmPluralValuedSimplePath<?> copy = new SqmPluralValuedSimplePath<>(
|
||||
path.getNavigablePath(),
|
||||
|
@ -771,11 +1036,11 @@ public class QuerySplitter {
|
|||
return copy;
|
||||
}
|
||||
|
||||
private SqmPath<?> findLhs(SqmPath<?> path, SqmPathRegistry pathRegistry) {
|
||||
private SqmPath<?> findLhs(SqmPath<?> path) {
|
||||
final SqmPath<?> lhs = path.getLhs();
|
||||
final SqmPath sqmFrom = sqmPathCopyMap.get( lhs.getNavigablePath() );
|
||||
if ( sqmFrom != null ) {
|
||||
return pathRegistry.findFromByPath( sqmFrom.getNavigablePath() );
|
||||
final SqmPath lhsSqmPathCopy = sqmPathCopyMap.get( lhs.getNavigablePath() );
|
||||
if ( lhsSqmPathCopy != null ) {
|
||||
return lhsSqmPathCopy;
|
||||
}
|
||||
else {
|
||||
return (SqmPath<?>) lhs.accept( this );
|
||||
|
@ -1022,6 +1287,28 @@ public class QuerySplitter {
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visitAny(SqmAny<?> sqmAny) {
|
||||
return new SqmAny<>(
|
||||
(SqmSubQuery<?>) sqmAny.getSubquery().accept( this ),
|
||||
this.creationContext.getNodeBuilder()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visitTreatedPath(SqmTreatedPath<?, ?> sqmTreatedPath) {
|
||||
throw new UnsupportedOperationException("Polymorphic queries: treat operator is not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visitEvery(SqmEvery<?> sqmEvery) {
|
||||
sqmEvery.getSubquery().accept( this );
|
||||
return new SqmEvery<>(
|
||||
(SqmSubQuery<?>) sqmEvery.getSubquery().accept( this ),
|
||||
this.creationContext.getNodeBuilder()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stack<SqmCreationProcessingState> getProcessingStateStack() {
|
||||
return processingStateStack;
|
||||
|
@ -1037,6 +1324,29 @@ public class QuerySplitter {
|
|||
return () -> false;
|
||||
}
|
||||
|
||||
public <X extends SqmFrom<?, ?>> X findSqmFromCopy(SqmFrom sqmFrom) {
|
||||
SqmFrom copy = sqmFromCopyMap.get( sqmFrom );
|
||||
if ( copy != null ) {
|
||||
return (X) copy;
|
||||
}
|
||||
else {
|
||||
return (X) sqmFrom.accept( this );
|
||||
}
|
||||
}
|
||||
|
||||
private void visitJoins(SqmFrom<?, ?> join, SqmJoin copy) {
|
||||
getProcessingStateStack().getCurrent().getPathRegistry().register( copy );
|
||||
sqmFromCopyMap.put( join, copy );
|
||||
sqmPathCopyMap.put( join.getNavigablePath(), copy );
|
||||
join.visitSqmJoins(
|
||||
sqmJoin ->
|
||||
sqmJoin.accept( this )
|
||||
);
|
||||
SqmFrom<?, ?> lhs = (SqmFrom<?, ?>) copy.getLhs();
|
||||
if ( lhs != null ) {
|
||||
lhs.addSqmJoin( copy );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,18 @@ import org.hibernate.query.sqm.tree.cte.SqmCteStatement;
|
|||
import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement;
|
||||
import org.hibernate.query.sqm.tree.domain.NonAggregatedCompositeSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmAnyValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmBagJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedBagJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedCrossJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedEntityJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedListJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedMapJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedPluralPartJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedRoot;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedRootJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedSetJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedSingularJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelation;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCteRoot;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmDerivedRoot;
|
||||
|
@ -23,11 +34,15 @@ import org.hibernate.query.sqm.tree.domain.SqmEmbeddedValuedSimplePath;
|
|||
import org.hibernate.query.sqm.tree.domain.SqmEntityValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmFkExpression;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmIndexedCollectionAccessPath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmListJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmMapEntryReference;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmElementAggregateFunction;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmIndexAggregateFunction;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmMapJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPluralPartJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPluralValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmSetJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmSingularJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmTreatedPath;
|
||||
import org.hibernate.query.sqm.tree.expression.JpaCriteriaParameter;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmAny;
|
||||
|
@ -147,6 +162,58 @@ public interface SemanticQueryWalker<T> {
|
|||
|
||||
T visitQualifiedAttributeJoin(SqmAttributeJoin<?, ?> joinedFromElement);
|
||||
|
||||
default T visitCorrelatedCrossJoin(SqmCorrelatedCrossJoin<?> join) {
|
||||
return visitCrossJoin( join );
|
||||
}
|
||||
|
||||
default T visitCorrelatedEntityJoin(SqmCorrelatedEntityJoin<?> join) {
|
||||
return visitQualifiedEntityJoin( join );
|
||||
}
|
||||
|
||||
default T visitCorrelatedPluralPartJoin(SqmCorrelatedPluralPartJoin<?, ?> join) {
|
||||
return visitPluralPartJoin( join );
|
||||
}
|
||||
|
||||
default T visitBagJoin(SqmBagJoin<?,?> join){
|
||||
return visitQualifiedAttributeJoin( join );
|
||||
}
|
||||
|
||||
default T visitCorrelatedBagJoin(SqmCorrelatedBagJoin<?, ?> join) {
|
||||
return visitQualifiedAttributeJoin( join );
|
||||
}
|
||||
|
||||
default T visitCorrelatedListJoin(SqmCorrelatedListJoin<?, ?> join) {
|
||||
return visitQualifiedAttributeJoin( join );
|
||||
}
|
||||
|
||||
default T visitCorrelatedMapJoin(SqmCorrelatedMapJoin<?, ?, ?> join) {
|
||||
return visitQualifiedAttributeJoin( join );
|
||||
}
|
||||
|
||||
default T visitCorrelatedSetJoin(SqmCorrelatedSetJoin<?, ?> join) {
|
||||
return visitQualifiedAttributeJoin( join );
|
||||
}
|
||||
|
||||
default T visitCorrelatedSingularJoin(SqmCorrelatedSingularJoin<?, ?> join) {
|
||||
return visitQualifiedAttributeJoin( join );
|
||||
}
|
||||
|
||||
default T visitListJoin(SqmListJoin<?, ?> join) {
|
||||
return visitQualifiedAttributeJoin( join );
|
||||
}
|
||||
|
||||
default T visitMapJoin(SqmMapJoin<?, ?, ?> join) {
|
||||
return visitQualifiedAttributeJoin( join );
|
||||
}
|
||||
|
||||
default T visitSetJoin(SqmSetJoin<?, ?> join) {
|
||||
return visitQualifiedAttributeJoin( join );
|
||||
}
|
||||
|
||||
default T visitSingularJoin(SqmSingularJoin<?, ?> join) {
|
||||
return visitQualifiedAttributeJoin( join );
|
||||
}
|
||||
|
||||
T visitQualifiedDerivedJoin(SqmDerivedJoin<?> joinedFromElement);
|
||||
|
||||
T visitQualifiedCteJoin(SqmCteJoin<?> joinedFromElement);
|
||||
|
@ -177,6 +244,13 @@ public interface SemanticQueryWalker<T> {
|
|||
|
||||
T visitCorrelation(SqmCorrelation<?, ?> correlation);
|
||||
|
||||
default T visitCorrelatedRootJoin(SqmCorrelatedRootJoin<?> correlatedRootJoin){
|
||||
return visitCorrelation( correlatedRootJoin );
|
||||
}
|
||||
|
||||
default T visitCorrelatedRoot(SqmCorrelatedRoot<?> correlatedRoot){
|
||||
return visitCorrelation( correlatedRoot );
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Query spec
|
||||
|
@ -328,4 +402,5 @@ public interface SemanticQueryWalker<T> {
|
|||
T visitMapEntryFunction(SqmMapEntryReference<?, ?> function);
|
||||
|
||||
T visitFullyQualifiedClass(Class<?> namedClass);
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Collection;
|
|||
|
||||
import org.hibernate.metamodel.model.domain.BagPersistentAttribute;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.query.criteria.JpaCollectionJoin;
|
||||
import org.hibernate.query.criteria.JpaExpression;
|
||||
|
@ -81,6 +82,11 @@ public class SqmBagJoin<O, E> extends AbstractSqmPluralJoin<O,Collection<E>, E>
|
|||
return getReferencedPathSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitBagJoin( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BagPersistentAttribute<O,E> getAttribute() {
|
||||
//noinspection unchecked
|
||||
|
@ -149,4 +155,5 @@ public class SqmBagJoin<O, E> extends AbstractSqmPluralJoin<O,Collection<E>, E>
|
|||
nodeBuilder()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.hibernate.metamodel.model.domain.BagPersistentAttribute;
|
|||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.SqmCopyContext;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
|
@ -74,6 +75,11 @@ public class SqmCorrelatedBagJoin<O, T> extends SqmBagJoin<O, T> implements SqmC
|
|||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitCorrelatedBagJoin( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmBagJoin<O, T> getCorrelationParent() {
|
||||
return correlationParent;
|
||||
|
@ -108,4 +114,5 @@ public class SqmCorrelatedBagJoin<O, T> extends SqmBagJoin<O, T> implements SqmC
|
|||
pathRegistry.findFromByPath( correlationParent.getNavigablePath() )
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.hibernate.query.sqm.tree.domain;
|
|||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.SqmCopyContext;
|
||||
import org.hibernate.query.sqm.tree.from.SqmCrossJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmRoot;
|
||||
|
@ -94,4 +95,10 @@ public class SqmCorrelatedCrossJoin<T> extends SqmCrossJoin<T> implements SqmCor
|
|||
pathRegistry.findFromByPath( correlationParent.getNavigablePath() )
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitCorrelatedCrossJoin( this );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.hibernate.query.sqm.tree.domain;
|
|||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.SqmCopyContext;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.from.SqmEntityJoin;
|
||||
|
@ -67,6 +68,11 @@ public class SqmCorrelatedEntityJoin<T> extends SqmEntityJoin<T> implements SqmC
|
|||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitCorrelatedEntityJoin(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmEntityJoin<T> getCorrelationParent() {
|
||||
return correlationParent;
|
||||
|
@ -99,4 +105,5 @@ public class SqmCorrelatedEntityJoin<T> extends SqmEntityJoin<T> implements SqmC
|
|||
pathRegistry.findFromByPath( correlationParent.getNavigablePath() )
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.hibernate.metamodel.model.domain.ListPersistentAttribute;
|
|||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.SqmCopyContext;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
|
@ -108,4 +109,9 @@ public class SqmCorrelatedListJoin<O, T> extends SqmListJoin<O, T> implements Sq
|
|||
pathRegistry.findFromByPath( correlationParent.getNavigablePath() )
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitCorrelatedListJoin( this );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.hibernate.metamodel.model.domain.MapPersistentAttribute;
|
|||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.SqmCopyContext;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
|
@ -108,4 +109,9 @@ public class SqmCorrelatedMapJoin<O, K, V> extends SqmMapJoin<O, K, V> implement
|
|||
pathRegistry.findFromByPath( correlationParent.getNavigablePath() )
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitCorrelatedMapJoin( this );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.tree.domain;
|
||||
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.SqmCopyContext;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
|
@ -46,6 +47,16 @@ public class SqmCorrelatedPluralPartJoin<O, T> extends SqmPluralPartJoin<O, T> i
|
|||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitCorrelatedPluralPartJoin( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmFrom<?, T> getLhs() {
|
||||
return (SqmFrom<?, T>) super.getLhs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmPluralPartJoin<O, T> getCorrelationParent() {
|
||||
return correlationParent;
|
||||
|
@ -65,4 +76,5 @@ public class SqmCorrelatedPluralPartJoin<O, T> extends SqmPluralPartJoin<O, T> i
|
|||
public SqmRoot<O> getCorrelatedRoot() {
|
||||
return correlatedRootJoin;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -80,6 +80,6 @@ public class SqmCorrelatedRoot<T> extends SqmRoot<T> implements SqmPathWrapper<T
|
|||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitCorrelation( this );
|
||||
return walker.visitCorrelatedRoot( this );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.hibernate.query.sqm.tree.from.SqmRoot;
|
|||
*/
|
||||
public class SqmCorrelatedRootJoin<T> extends SqmRoot<T> implements SqmCorrelation<T, T> {
|
||||
|
||||
SqmCorrelatedRootJoin(
|
||||
public SqmCorrelatedRootJoin(
|
||||
NavigablePath navigablePath,
|
||||
SqmPathSource<T> referencedNavigable,
|
||||
NodeBuilder nodeBuilder) {
|
||||
|
@ -89,6 +89,7 @@ public class SqmCorrelatedRootJoin<T> extends SqmRoot<T> implements SqmCorrelati
|
|||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitCorrelation( this );
|
||||
return walker.visitCorrelatedRootJoin( this );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.hibernate.metamodel.model.domain.SetPersistentAttribute;
|
|||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.SqmCopyContext;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
|
@ -108,4 +109,9 @@ public class SqmCorrelatedSetJoin<O, T> extends SqmSetJoin<O, T> implements SqmC
|
|||
pathRegistry.findFromByPath( correlationParent.getNavigablePath() )
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitCorrelatedSetJoin( this );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.hibernate.metamodel.model.domain.SingularPersistentAttribute;
|
|||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.tree.SqmCopyContext;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
|
@ -108,4 +109,9 @@ public class SqmCorrelatedSingularJoin<O, T> extends SqmSingularJoin<O, T> imple
|
|||
pathRegistry.findFromByPath( correlationParent.getNavigablePath() )
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitCorrelatedSingularJoin( this );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,4 +17,5 @@ import org.hibernate.query.sqm.tree.from.SqmRoot;
|
|||
*/
|
||||
public interface SqmCorrelation<O, T> extends SqmFrom<O, T>, SqmPathWrapper<T, T> {
|
||||
SqmRoot<O> getCorrelatedRoot();
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.List;
|
|||
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.metamodel.model.domain.ListPersistentAttribute;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.query.criteria.JpaExpression;
|
||||
import org.hibernate.query.criteria.JpaListJoin;
|
||||
|
@ -84,6 +85,11 @@ public class SqmListJoin<O,E>
|
|||
return getReferencedPathSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitListJoin( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListPersistentAttribute<O,E> getAttribute() {
|
||||
//noinspection unchecked
|
||||
|
@ -156,4 +162,5 @@ public class SqmListJoin<O,E>
|
|||
nodeBuilder()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import jakarta.persistence.criteria.Predicate;
|
|||
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.metamodel.model.domain.MapPersistentAttribute;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.query.criteria.JpaExpression;
|
||||
import org.hibernate.query.criteria.JpaMapJoin;
|
||||
|
@ -83,6 +84,11 @@ public class SqmMapJoin<O, K, V>
|
|||
return (MapPersistentAttribute<O, K, V>) super.getModel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitMapJoin( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapPersistentAttribute<O, K, V> getAttribute() {
|
||||
//noinspection unchecked
|
||||
|
@ -170,4 +176,5 @@ public class SqmMapJoin<O, K, V>
|
|||
nodeBuilder()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Set;
|
|||
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.metamodel.model.domain.SetPersistentAttribute;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.query.criteria.JpaExpression;
|
||||
import org.hibernate.query.criteria.JpaPredicate;
|
||||
|
@ -83,6 +84,11 @@ public class SqmSetJoin<O, E>
|
|||
return getReferencedPathSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitSetJoin( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetPersistentAttribute<O,E> getAttribute() {
|
||||
return getReferencedPathSource();
|
||||
|
@ -142,6 +148,7 @@ public class SqmSetJoin<O, E>
|
|||
return fetch( attributeName, JoinType.INNER);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SqmAttributeJoin<O, E> makeCopy(SqmCreationProcessingState creationProcessingState) {
|
||||
return new SqmSetJoin<>(
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Locale;
|
|||
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.metamodel.model.domain.SingularPersistentAttribute;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
|
@ -43,6 +44,11 @@ public class SqmSingularJoin<O,T> extends AbstractSqmAttributeJoin<O,T> {
|
|||
super( lhs, joinedNavigable, alias, joinType, fetched, nodeBuilder );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||
return walker.visitSingularJoin(this);
|
||||
}
|
||||
|
||||
protected SqmSingularJoin(
|
||||
SqmFrom<?, O> lhs,
|
||||
NavigablePath navigablePath,
|
||||
|
|
|
@ -6,13 +6,12 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.tree.from;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Remove;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.query.criteria.JpaFetch;
|
||||
import org.hibernate.query.criteria.JpaJoin;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
|
||||
|
@ -44,15 +43,11 @@ public interface SqmAttributeJoin<O,T> extends SqmQualifiedJoin<O,T>, JpaFetch<O
|
|||
@Override
|
||||
<S extends T> SqmAttributeJoin<O, S> treatAs(EntityDomainType<S> treatTarget);
|
||||
|
||||
/*
|
||||
@deprecated not used anymore
|
||||
*/
|
||||
@Deprecated
|
||||
@Remove
|
||||
SqmAttributeJoin makeCopy( SqmCreationProcessingState creationProcessingState );
|
||||
|
||||
class NotJoinableException extends HibernateException {
|
||||
public NotJoinableException(String message) {
|
||||
super( message );
|
||||
}
|
||||
|
||||
public NotJoinableException(String message, Throwable cause) {
|
||||
super( message, cause );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue