java.lang.Object
com.broadleafcommerce.billing.provider.jpa.repository.QueryUtil

public class QueryUtil extends Object
Utilities for working with JPA queries
  • Constructor Details

    • QueryUtil

      public QueryUtil()
  • Method Details

    • optimizeTransactionalBehavior

      public <T> T optimizeTransactionalBehavior(Supplier<T> supplier)
      If running in a transaction, set Hibernate's session flush mode to COMMIT, and then reset to AUTO upon exit. If it is known the logic in the flow will not be impacted by immediate stale reads after an update during the transaction, then this optimization can be added. Enabled by default where used. Can be disabled by setting the broadleaf.billing.query.enable-transaction-query-read-optimization property to false.
      Type Parameters:
      T - The type of the response object
      Parameters:
      supplier - The method logic to wrap in the optimized behavior
      Returns:
      The wrapped method response
    • optimizeTransactionalBehavior

      public void optimizeTransactionalBehavior(Runnable executor)
      If running in a transaction, set Hibernate's session flush mode to COMMIT, and then reset to AUTO upon exit. If it is known the logic in the flow will not be impacted by immediate stale reads after an update during the transaction, then this optimization can be added. Enabled by default where used. Can be disabled by setting the broadleaf.billing.query.enable-transaction-query-read-optimization property to false.
      Parameters:
      executor - The void method logic to wrap in the optimized behavior