hibernate-orm
hibernate-orm copied to clipboard
HHH-14200 Invalid SQL generated while using clause with count of collection-valued attribute
https://hibernate.atlassian.net/browse/HHH-14200
The root cause is we didn't invoke 'initText()' for collection type in DotNode#resolve()
as in the following snippet:
else if ( propertyType.isEntityType() ) {
// The property is another class..
checkLhsIsNotCollection();
dereferenceEntity( (EntityType) propertyType, implicitJoin, classAlias, generateJoin, parent, parentPredicate );
initText();
}
else if ( propertyType.isCollectionType() ) {
// The property is a collection...
checkLhsIsNotCollection();
dereferenceCollection( (CollectionType) propertyType, implicitJoin, false, classAlias, parent );
}
else {
// Otherwise, this is a primitive type.
if ( !CollectionProperties.isAnyCollectionProperty( propertyName ) ) {
checkLhsIsNotCollection();
}
dereferenceType = DereferenceType.PRIMITIVE;
initText();
}
Adding the missing `initText() fixed the issue.