devxlogo

January 16, 2020

How to Use FetchMode.JOIN to Fetch Collection

By annotating an associated collection with FetchMode.JOIN we force it to be loaded EAGER: @OneToMany(fetch = FetchType.LAZY)@Fetch(FetchMode.JOIN)private List = new ArrayList(); Or: @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = “foo_id”) @Fetch(FetchMode.JOIN) private