廣告

2016年6月23日 星期四

Hibernate Eager vs Lazy Fetch Type


  @OneToOne(fetch=FetchType.EAGER) //LAZY
  @JoinColumn(name="user_profile_id")
  private Profile getUserProfile()
  {
   return userProfile;
  }

 FetchType.LAZY = Doesn’t load the relationships 
 unless explicitly “asked for” via getter
 FetchType.EAGER = Loads ALL relationships

ref:
https://m.oschina.net/blog/327056
https://howtoprogramwithjava.com/hibernate-eager-vs-lazy-fetch-type/

沒有留言:

張貼留言