Skip to content

Commit

Permalink
[#701] Prevent expansion of basic element types in collection bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mobe91 authored and beikov committed Dec 19, 2018
1 parent 3a3f369 commit 2ce6b63
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Integer> bindingMap, Map<String, String> columnBindingMap, Map<String, ExtendedAttribute<?, ?>> attributeEntries, ClauseType clause, AbstractCommonQueryBuilder<?, ?, ?, ?, ?> queryBuilder) {
SelectManager<?> selectManager = queryBuilder.selectManager;
JoinManager joinManager = queryBuilder.joinManager;
Expand All @@ -77,7 +81,7 @@ public static void expandBindings(EntityType<?> bindType, Map<String, Integer> 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++) {
Expand Down

0 comments on commit 2ce6b63

Please sign in to comment.