diff --git a/modules/gui/src/com/haulmont/cuba/gui/components/actions/RelatedAction.java b/modules/gui/src/com/haulmont/cuba/gui/components/actions/RelatedAction.java index 7e50486056..051558677e 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/components/actions/RelatedAction.java +++ b/modules/gui/src/com/haulmont/cuba/gui/components/actions/RelatedAction.java @@ -197,26 +197,24 @@ public class RelatedAction extends BaseAction implements Action.HasBeforeActionP if (cardinality == Cardinality.MANY_TO_ONE) { return getManyToOneCondition(parentIds, datasource, filterComponentName, primaryKey); - } else if (cardinality == Cardinality.ONE_TO_MANY) { + } else if (cardinality == Cardinality.ONE_TO_MANY || cardinality == Cardinality.ONE_TO_ONE) { return getOneToManyCondition(parentIds, datasource, filterComponentName, primaryKey); } else if (cardinality == Cardinality.MANY_TO_MANY) { return getManyToManyCondition(parentIds, datasource, filterComponentName, primaryKey); - } else if (cardinality == Cardinality.ONE_TO_ONE) { - return getOneToOneCondition(parentIds, datasource, filterComponentName, primaryKey); } return null; } @Nullable - protected AbstractCondition getOneToOneCondition(List parentIds, CollectionDatasource datasource, String filterComponentName, String primaryKey) { + protected AbstractCondition getOneToManyCondition(List parentIds, CollectionDatasource datasource, String filterComponentName, String primaryKey) { MetaProperty inverseField = metaProperty.getInverse(); if (inverseField == null) { return null; } - CustomCondition customCondition = getCustomCondition(parentIds, datasource, filterComponentName, primaryKey, false); + CustomCondition customCondition = getCustomCondition(parentIds, datasource, filterComponentName, primaryKey, true); - String whereString = String.format("{E}.%s.id = :%s", inverseField.getName(), paramName); + String whereString = String.format("{E}.%s.id in :%s", inverseField.getName(), paramName); customCondition.setWhere(whereString); return customCondition; @@ -242,21 +240,6 @@ public class RelatedAction extends BaseAction implements Action.HasBeforeActionP return customCondition; } - @Nullable - protected AbstractCondition getOneToManyCondition(List parentIds, CollectionDatasource datasource, String filterComponentName, String primaryKey) { - MetaProperty inverseField = metaProperty.getInverse(); - if (inverseField == null) { - return null; - } - - CustomCondition condition = getCustomCondition(parentIds, datasource, filterComponentName, primaryKey, true); - - String whereString = String.format("{E}.%s.id in :%s", inverseField.getName(), paramName); - condition.setWhere(whereString); - - return condition; - } - @Nullable protected AbstractCondition getManyToOneCondition(List parentIds, CollectionDatasource datasource, String filterComponentName, String primaryKey) { MetaProperty inverseField = metaProperty.getInverse();