mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-04 20:28:00 +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);
|
resultList = getResultList(context, query, ensureDistinct);
|
||||||
|
|
||||||
// Fetch dynamic attributes
|
// Fetch dynamic attributes
|
||||||
if (context.getView() != null
|
if (!resultList.isEmpty() && resultList.get(0) instanceof BaseGenericIdEntity && context.isLoadDynamicAttributes()) {
|
||||||
&& BaseGenericIdEntity.class.isAssignableFrom(context.getView().getEntityClass())
|
|
||||||
&& context.isLoadDynamicAttributes()) {
|
|
||||||
dynamicAttributesManagerAPI.fetchDynamicAttributes((List<BaseGenericIdEntity>) resultList);
|
dynamicAttributesManagerAPI.fetchDynamicAttributes((List<BaseGenericIdEntity>) resultList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,12 +220,19 @@ public class DataManagerTest {
|
|||||||
|
|
||||||
LoadContext<Server> loadContext = LoadContext.create(Server.class).setId(id).setLoadDynamicAttributes(true);
|
LoadContext<Server> loadContext = LoadContext.create(Server.class).setId(id).setLoadDynamicAttributes(true);
|
||||||
server = dataManager.load(loadContext);
|
server = dataManager.load(loadContext);
|
||||||
|
assertNotNull(server.getDynamicAttributes());
|
||||||
server = dataManager.reload(server, View.LOCAL);
|
server = dataManager.reload(server, View.LOCAL);
|
||||||
assertNotNull(server.getDynamicAttributes());
|
assertNotNull(server.getDynamicAttributes());
|
||||||
|
|
||||||
loadContext = LoadContext.create(Server.class).setId(id).setLoadDynamicAttributes(false);
|
loadContext = LoadContext.create(Server.class).setId(id).setLoadDynamicAttributes(false);
|
||||||
server = dataManager.load(loadContext);
|
server = dataManager.load(loadContext);
|
||||||
assertNull(server.getDynamicAttributes());
|
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
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user