Skip to content

Commit cf7b58e

Browse files
committed
HHH-19759 - Avoid a ClassCastException when joining on a basic value type
Signed-off-by: Jan Schatteman <[email protected]>
1 parent 4f84332 commit cf7b58e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPathConsumer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ else if ( fetch ) {
207207
}
208208
}
209209
}
210+
if ( !(subPathSource instanceof SqmJoinable) ) {
211+
throw new SemanticException( "Joining on basic value elements is not supported",
212+
((SemanticQueryBuilder<?>) creationState).getQuery() );
213+
}
210214
@SuppressWarnings("unchecked")
211215
final SqmJoinable<U, ?> joinSource = (SqmJoinable<U, ?>) subPathSource;
212216
return createJoin( lhs, joinType, alias, fetch, isTerminal, allowReuse, creationState, joinSource );

hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ public Stack<SqmCreationProcessingState> getProcessingStateStack() {
414414
return processingStateStack;
415415
}
416416

417+
public String getQuery() {
418+
return query;
419+
}
420+
417421
private NodeBuilder nodeBuilder() {
418422
return creationContext.getNodeBuilder();
419423
}

0 commit comments

Comments
 (0)