Spring Data MongoDB - lazy access to some fields

蓝咒 提交于 2020-07-09 06:44:19

问题


Is it possible to mark field of the class that it will be lazy-loaded?

Example:

public class Dictionary {
    private String id;
    private String someDescription;
    private String someInfo;

    private Map<String, String> dictionary;
}

I want to mark "dictionary" field to be lazy-accessed. Why? This field can be huge and I need it only sometimes, not always. For example I have another object that contains a lot of Dictionary. And its main purpose is to present information from all contained Dictionaries (we need only someDescription, someInfo and so on, not playload) and than if needed we can get "dictionary" filed if it's needed.

来源:https://stackoverflow.com/questions/48927301/spring-data-mongodb-lazy-access-to-some-fields

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!