java - EJB 3 Eager loading -


i work ejb 3. have base class , there dependency classes b,c,d

@entity @table(name = "a") public class implements serializable {      @onetomany(cascade = cascadetype.all)     private list<b> bs;      @onetomany(cascade = cascadetype.all)     private list<c> cs;      @onetomany(cascade = cascadetype.all)     private list<d> ds;  } 

i have question. how can load tables eagerly? want use em.find(a.class, id);

you must use fetch attribute in onetomany annotation so:

@entity @table(name = "a") public class implements serializable {      @onetomany(cascade = cascadetype.all, fetch = fetchtype.eager)     private list<b> bs;      @onetomany(cascade = cascadetype.all, fetch = fetchtype.eager)     private list<c> cs;      @onetomany(cascade = cascadetype.all, fetch = fetchtype.eager)     private list<d> ds;  } 

Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -