mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-03 03:38:33 +08:00
PL-8926 When the entity with composite key has dynamic attribute an attempt to read it leads to exception
This commit is contained in:
parent
ef89ad7e32
commit
cf4fa68b1b
@ -29,6 +29,7 @@ import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.cuba.core.app.dynamicattributes.PropertyType;
|
||||
import com.haulmont.cuba.core.entity.CategoryAttribute;
|
||||
import com.haulmont.cuba.core.entity.Entity;
|
||||
import com.haulmont.cuba.core.entity.HasUuid;
|
||||
import com.haulmont.cuba.core.global.*;
|
||||
import com.haulmont.cuba.core.global.filter.SecurityJpqlGenerator;
|
||||
import com.haulmont.cuba.gui.ScreensHelper;
|
||||
@ -238,9 +239,11 @@ public class AttributeEditor extends AbstractEditor<CategoryAttribute> {
|
||||
MetaClass entityType = null;
|
||||
for (MetaClass metaClass : metadataTools.getAllPersistentMetaClasses()) {
|
||||
if (!metadataTools.isSystemLevel(metaClass)) {
|
||||
if (metadata.getTools().hasCompositePrimaryKey(metaClass) && !HasUuid.class.isAssignableFrom(metaClass.getJavaClass())) {
|
||||
continue;
|
||||
}
|
||||
options.put(messageTools.getDetailedEntityCaption(metaClass), metaClass.getJavaClass().getName());
|
||||
if (attribute != null
|
||||
&& metaClass.getJavaClass().getName().equals(attribute.getEntityClass())) {
|
||||
if (attribute != null && metaClass.getJavaClass().getName().equals(attribute.getEntityClass())) {
|
||||
entityType = metaClass;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package com.haulmont.cuba.gui.app.core.categories;
|
||||
|
||||
import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.cuba.core.entity.Category;
|
||||
import com.haulmont.cuba.core.entity.HasUuid;
|
||||
import com.haulmont.cuba.core.global.*;
|
||||
import com.haulmont.cuba.gui.components.AbstractEditor;
|
||||
import com.haulmont.cuba.gui.components.CheckBox;
|
||||
@ -59,6 +60,9 @@ public class CategoryEditor extends AbstractEditor<Category> {
|
||||
for (MetaClass metaClass : metadata.getTools().getAllPersistentMetaClasses()) {
|
||||
String storeName = metadata.getTools().getStoreName(metaClass);
|
||||
if (Stores.isMain(storeName)) {
|
||||
if (metadata.getTools().hasCompositePrimaryKey(metaClass) && !HasUuid.class.isAssignableFrom(metaClass.getJavaClass())) {
|
||||
continue;
|
||||
}
|
||||
options.put(messageTools.getDetailedEntityCaption(metaClass), metaClass);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user