Evaluating of referenced entity primaryKey name when building a query for generic filter #PL-4821 Fixed Fix versions: 5.4.0

This commit is contained in:
Maxim Gorbunkov 2015-02-03 11:22:55 +00:00
parent 028a274e9d
commit db17a2ca8c

View File

@ -9,9 +9,7 @@ import com.google.common.base.Strings;
import com.haulmont.chile.core.annotations.MetaClass;
import com.haulmont.chile.core.model.MetaProperty;
import com.haulmont.cuba.core.entity.annotation.SystemLevel;
import com.haulmont.cuba.core.global.AppBeans;
import com.haulmont.cuba.core.global.MessageTools;
import com.haulmont.cuba.core.global.Messages;
import com.haulmont.cuba.core.global.*;
import com.haulmont.cuba.gui.components.filter.operationedit.AbstractOperationEditor;
import com.haulmont.cuba.gui.components.filter.Op;
import com.haulmont.cuba.gui.components.filter.Param;
@ -94,7 +92,11 @@ public class PropertyCondition extends AbstractCondition {
sb.append(entityAlias).append(".").append(name);
if (Param.Type.ENTITY == param.getType()) {
sb.append(".id");
Metadata metadata = AppBeans.get(Metadata.class);
com.haulmont.chile.core.model.MetaClass metaClass = metadata.getClassNN(param.getJavaClass());
String primaryKeyName = metadata.getTools().getPrimaryKeyName(metaClass);
sb.append("." + primaryKeyName);
}
if (operator != Op.NOT_EMPTY)