diff --git a/core/impl/src/main/java/com/blazebit/persistence/impl/JpaUtils.java b/core/impl/src/main/java/com/blazebit/persistence/impl/JpaUtils.java index c0210b61d6..55328b0749 100644 --- a/core/impl/src/main/java/com/blazebit/persistence/impl/JpaUtils.java +++ b/core/impl/src/main/java/com/blazebit/persistence/impl/JpaUtils.java @@ -57,6 +57,10 @@ public final class JpaUtils { private JpaUtils() { } + private static boolean isBasicElementType(Attribute attribute) { + return attribute instanceof PluralAttribute && ((PluralAttribute) attribute).getElementType().getPersistenceType() == Type.PersistenceType.BASIC; + } + public static void expandBindings(EntityType bindType, Map bindingMap, Map columnBindingMap, Map> attributeEntries, ClauseType clause, AbstractCommonQueryBuilder queryBuilder) { SelectManager selectManager = queryBuilder.selectManager; JoinManager joinManager = queryBuilder.joinManager; @@ -77,7 +81,7 @@ public static void expandBindings(EntityType bindType, Map b final Attribute lastAttribute = attributePath.get(attributePath.size() - 1); boolean splitExpression = lastAttribute.getPersistentAttributeType() == Attribute.PersistentAttributeType.EMBEDDED; - if (!splitExpression && jpaMetamodelAccessor.isJoinable(lastAttribute)) { + if (!splitExpression && jpaMetamodelAccessor.isJoinable(lastAttribute) && !isBasicElementType(lastAttribute)) { splitExpression = true; if (needsElementCollectionIdCutoff) { for (int i = 0; i < attributePath.size() - 1; i++) {