@@ -142,7 +142,7 @@ public TQRootBean(Class<T> beanType, Database database) {
142142 @ SuppressWarnings ("unchecked" )
143143 public TQRootBean (Query <T > query ) {
144144 this .query = query ;
145- this .root = (R )this ;
145+ this .root = (R ) this ;
146146 }
147147
148148 /**
@@ -157,7 +157,7 @@ public TQRootBean(boolean aliasDummy) {
157157 * Return the fetch group.
158158 */
159159 public FetchGroup <T > buildFetchGroup () {
160- return ((SpiFetchGroupQuery )query ()).buildFetchGroup ();
160+ return ((SpiFetchGroupQuery ) query ()).buildFetchGroup ();
161161 }
162162
163163 /**
@@ -314,6 +314,26 @@ public R fetchQuery(String path) {
314314 return root ;
315315 }
316316
317+ /**
318+ * Specify a path to load from L2 cache including all its properties.
319+ *
320+ * <pre>{@code
321+ *
322+ * List<Order> orders =
323+ * new QOrder()
324+ * // eager fetch the customer using L2 cache
325+ * .fetchCache("customer")
326+ * .findList();
327+ *
328+ * }</pre>
329+ *
330+ * @param path the property path to load from L2 cache.
331+ */
332+ public R fetchCache (String path ) {
333+ query .fetchCache (path );
334+ return root ;
335+ }
336+
317337 /**
318338 * Specify a path and properties to load using a "query join".
319339 *
@@ -327,13 +347,35 @@ public R fetchQuery(String path) {
327347 *
328348 * }</pre>
329349 *
330- * @param path the property path of an associated (OneToOne, OneToMany, ManyToOne or ManyToMany) bean.
350+ * @param path the property path of an associated (OneToOne, OneToMany, ManyToOne or ManyToMany) bean.
351+ * @param properties the properties to load for this path.
331352 */
332353 public R fetchQuery (String path , String properties ) {
333354 query .fetchQuery (path , properties );
334355 return root ;
335356 }
336357
358+ /**
359+ * Specify a path and properties to load from L2 cache.
360+ *
361+ * <pre>{@code
362+ *
363+ * List<Order> orders =
364+ * new QOrder()
365+ * // eager fetch the customer using L2 cache
366+ * .fetchCache("customer", "name,status")
367+ * .findList();
368+ *
369+ * }</pre>
370+ *
371+ * @param path the property path to load from L2 cache.
372+ * @param properties the properties to load for this path.
373+ */
374+ public R fetchCache (String path , String properties ) {
375+ query .fetchCache (path , properties );
376+ return root ;
377+ }
378+
337379 /**
338380 * Specify a path to <em>fetch</em> with its specific properties to include
339381 * (aka partial object).
0 commit comments