dcsimg
LinkedIn
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

How to Use FetchMode.JOIN to Fetch Collection

Language: Java, Expertise: Intermediate: See what happens when you annotate an associated collection with FetchMode.JOIN.


advertisement

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 Foo foo;


   
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date