Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: antlr-rework, 5.1.0
    • Component/s: None
    • Labels:
      None
    • Last commented by a user?:
      true

      Description

      Hibernate does not have any explicit handling for excessive expressions in an in-list expression in HQL. There are many reported issues that come out of this (see linked issues, and their linked issues). In my opinion, the vast majority of these come from (imo) invalid queries.

      However, there is one use case where this complaint comes up that is valid imo; specifically the case of wanting to load multiple entities by id at one shot. We should develop an API for allowing this. Something along the lines of:

      IdentifierLoadAccess.java
      public interface IdentifierLoadAccess<T> {
          ...
          <K extends Serializable> List<T> multiLoad(K... ids);
          <K extends Serializable> List<T> multiLoad(List<K> ids);
      }
      

      In support of that (and batch fetch loading too), consider adding a "optimal batch size" determination strategy. Today we rely on the user explicitly telling us the batch size to use. Would be nice to have a determination for that as a default, especially a Dialect-specific determination:

      BatchLoadSizingStrategy.java
      public interface BatchLoadSizingStrategy {
          int determineOptimalBatchLoadSize(int numberOfKeyColumns, int numberOfKeys);
      }
      
      Dialect.java
      public class Dialect {
          ...
          public BatchLoadSizingStrategy getDefaultBatchLoadSizingStrategy() {
              ...
          }
      }
      

      Also allow users to specify a custom BatchLoadSizingStrategy; the Dialect one is just the default.

      Would also be nice to allow batch fetch loading to leverage this strategy-based determination. One option would be to simply make the size on @BatchSize optional. That unfortunately leaves @BatchSize poorly named overall. Maybe deprecating @BatchSize in favor of a new @BatchLoadable with an optional size attribute is better?

        Attachments

          Issue links

            Activity

              People

              • Votes:
                5 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 3h 37m
                  3h 37m