mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-04 12:17:41 +08:00
PL-7970 Dynamic attributes aren't fetched if view was not set to the LoadContext
This commit is contained in:
parent
75ec0b7bfe
commit
3ae2901a32
@ -190,9 +190,7 @@ public class RdbmsStore implements DataStore {
|
||||
resultList = getResultList(context, query, ensureDistinct);
|
||||
|
||||
// Fetch dynamic attributes
|
||||
if (context.getView() != null
|
||||
&& BaseGenericIdEntity.class.isAssignableFrom(context.getView().getEntityClass())
|
||||
&& context.isLoadDynamicAttributes()) {
|
||||
if (!resultList.isEmpty() && resultList.get(0) instanceof BaseGenericIdEntity && context.isLoadDynamicAttributes()) {
|
||||
dynamicAttributesManagerAPI.fetchDynamicAttributes((List<BaseGenericIdEntity>) resultList);
|
||||
}
|
||||
|
||||
|
@ -220,12 +220,19 @@ public class DataManagerTest {
|
||||
|
||||
LoadContext<Server> loadContext = LoadContext.create(Server.class).setId(id).setLoadDynamicAttributes(true);
|
||||
server = dataManager.load(loadContext);
|
||||
assertNotNull(server.getDynamicAttributes());
|
||||
server = dataManager.reload(server, View.LOCAL);
|
||||
assertNotNull(server.getDynamicAttributes());
|
||||
|
||||
loadContext = LoadContext.create(Server.class).setId(id).setLoadDynamicAttributes(false);
|
||||
server = dataManager.load(loadContext);
|
||||
assertNull(server.getDynamicAttributes());
|
||||
|
||||
loadContext = LoadContext.create(Server.class).setLoadDynamicAttributes(true);
|
||||
loadContext.setQueryString("select s from sys$Server s where s.id = :id")
|
||||
.setParameter("id", id);
|
||||
List<Server> resultList = dataManager.loadList(loadContext);
|
||||
assertNotNull(resultList.get(0).getDynamicAttributes());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user