Could not write content: failed to lazily initialize a collection of role

后端 未结 9 1317
说谎
说谎 2021-02-08 02:48

I have One-To-Many relationship, here is my code

@Entity
@Table(name = \"catalog\")
public class Catalog {

    @Id
    @GeneratedValue(strategy = GenerationType         


        
9条回答
  •  无人共我
    2021-02-08 03:35

    I think the best solution to your problem (which also is the simplest) is to set your FetchType to LAZY and simply annotate the oneToMany collection fields using @transient. Setting FetchType to EAGER isn't a good idea most times. Best of luck.

提交回复
热议问题