LazyInitializationException with graphql-spring

前端 未结 6 1389
庸人自扰
庸人自扰 2020-12-31 04:21

I am currently in the middle of migrating my REST-Server to GraphQL (at least partly). Most of the work is done, but i stumbled upon this problem which i seem to be unable t

6条回答
  •  攒了一身酷
    2020-12-31 05:06

    I am assuming that whenever you fetch an object of Show, you want all the associated Competition of the Show object.

    By default the fetch type for all collections type in an entity is LAZY. You can specify the EAGER type to make sure hibernate fetches the collection.

    In your Show class you can change the fetchType to EAGER.

    @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
    private List competition;
    

提交回复
热议问题