Skip to content

Commit 3a6f051

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

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
@@ -212,6 +212,10 @@ else if ( fetch ) {
212212
}
213213
}
214214
}
215+
if ( !(subPathSource instanceof SqmJoinable) ) {
216+
throw new SemanticException( "Joining on basic value elements is not supported",
217+
((SemanticQueryBuilder<?>) creationState).getQuery() );
218+
}
215219
@SuppressWarnings("unchecked")
216220
final SqmJoinable<U, ?> joinSource = (SqmJoinable<U, ?>) subPathSource;
217221
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
@@ -436,6 +436,10 @@ public Stack<SqmCreationProcessingState> getProcessingStateStack() {
436436
return processingStateStack;
437437
}
438438

439+
public String getQuery() {
440+
return query;
441+
}
442+
439443
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
440444
// Grammar rules
441445

0 commit comments

Comments
 (0)