borinquenkid commented on code in PR #15568:
URL: https://github.com/apache/grails-core/pull/15568#discussion_r3469170898
##########
grails-data-hibernate7/core/src/main/groovy/grails/orm/HibernateCriteriaBuilder.java:
##########
@@ -68,226 +75,1274 @@
* }
* maxResults(10)
* order("holderLastName", "desc")
+ * cache(true)
+ * readOnly(true)
* }
* </pre>
- * <p>The builder can also be instantiated standalone with a SessionFactory
and persistent Class instance:
+ *
+ * <h2>Advanced Features</h2>
+ *
+ * <p>The builder supports several advanced Hibernate features:
+ *
+ * <ul>
+ * <li><b>Pessimistic Locking:</b> Use {@code lock(true)} to obtain a
pessimistic write lock.
+ * <li><b>Query Caching:</b> Use {@code cache(true)} to enable query caching
for the results.
+ * <li><b>Read-Only Mode:</b> Use {@code readOnly(true)} to disable dirty
checking for loaded
+ * entities.
+ * <li><b>Fetch Mode:</b> Use {@code fetchMode("association",
FetchMode.JOIN)} to specify Eager/Lazy
+ * fetching strategies.
+ * </ul>
+ *
+ * <h2>Programmatic instantiation</h2>
+ *
+ * <p>The builder requires a {@link SessionFactory}, the target persistent
class, and the {@link
+ * org.grails.orm.hibernate.HibernateDatastore} that owns the session:
+ *
* <pre>
- * new HibernateCriteriaBuilder(clazz, sessionFactory).list {
+ * new HibernateCriteriaBuilder(Account, sessionFactory, datastore).list {
* eq("firstName", "Fred")
* }
* </pre>
*
+ * <h2>Architecture</h2>
+ *
+ * <p>Closure method calls in the DSL are dispatched through {@code
invokeMethod} → {@code
+ * CriteriaMethodInvoker} → {@link HibernateQuery}, which translates each GORM
constraint into the
+ * equivalent JPA Criteria predicate. {@link grails.gorm.DetachedCriteria} can
also be passed in
+ * place of a closure to support multi-tenant and reusable query fragments.
+ *
+ * To adjust the methods to be handled you have to extend this class, extend
CriteriaMethodInvoker
+ *
* @author Graeme Rocher
+ * @author walterduquedeestrada
Review Comment:
Removed. The fully-qualified class names and `var` are a style cleanup —
`HibernateCriteriaBuilder` is a port of existing code and those changes weren't
part of this PR. We can tackle that in a separate PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]