• 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:
    • Last commented by a user?:


      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:
      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:
      public interface BatchLoadSizingStrategy {
          int determineOptimalBatchLoadSize(int numberOfKeyColumns, int numberOfKeys);
      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?


          Issue links



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


                • Created:

                  Time Tracking

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