File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
hibernate-core/src/main/java/org/hibernate Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -267,9 +267,15 @@ public interface StatelessSession extends SharedSessionContract {
267267
268268/**
269269 * Fetch an association or collection that's configured for lazy loading.
270+ * <pre>
271+ * Book book = session.get(Book.class, isbn); // book is immediately detached
272+ * session.fetch(book.getAuthors()); // fetch the associated authors
273+ * book.getAuthors().forEach(author -> ... ); // iterate the collection
274+ * </pre>
270275 * <p>
271276 * Warning: this operation in a stateless session is quite sensitive
272- * to data aliasing effects and should be used with great care.
277+ * to data aliasing effects and should be used with great care. It's
278+ * usually better to fetch associations using eager join fetching.
273279 *
274280 * @param association a lazy-loaded association
275281 *
You can’t perform that action at this time.
0 commit comments