failed to lazily initialize a collection of role

前端 未结 4 812
盖世英雄少女心
盖世英雄少女心 2020-12-12 20:49

Hi I have two classes like this:

public class Indicator implements Serializable {
...

    @OneToMany(mappedBy = \"indicator\",fetch=FetchType.LAZY)
    priv         


        
4条回答
  •  时光说笑
    2020-12-12 21:44

    Try swich fetchType from LAZY to EAGER

    ...
    @OneToMany(fetch=FetchType.EAGER)
    private Set nodeValues;
    ...
    

    But in this case your app will fetch data from DB anyway. If this query very hard - this may impact on performance. More here: https://docs.oracle.com/javaee/6/api/javax/persistence/FetchType.html

    ==> 73

提交回复
热议问题