Hibernate ORM 5.1 introduced a new feature to enable multi-loading entities, HHH-7572. [1]

    This feature has some bugs that are fixed upstream in 5.2.2 that have not been backported to 5.1:

    • HHH-10617 : Returns results in the same order as specified IDs [2]
    • HHH-10984 : Have multiLoad not return (unflushed) DELETED entities [3]

    Without these bugfixes, results that are returned are surprising for the following reasons:

    1. the returned list of results does not correspond to the list of specified IDs;
    2. the resulting list can have a different length from the list of specified IDs;
    3. the resulting list excludes results for entities that don't exist (instead of a null value that corresponds to the specified ID);
    4. the resulting list can contain duplicated entities that are not due to duplicated IDs being specified; instead, duplicates are due to left outer joins;
    5. the resulting list can contain (non-flushed) deleted entities.

    The main reason I think this could be a blocker is that returning a deleted entity could corrupt data, depending on what the application ultimately does with the deleted entity.

    The fix for HHH-10617/HHH-10984 changes the default by making the resulting List as expected: the i-th entity returned corresponds with the i-th specified ID, or null when that entity does not exist or has been deleted (regardless of whether this operation was flushed).


      Gliffy Diagrams


          Issue Links



              • Assignee:
                gbadner Gail Badner
                gbadner Gail Badner
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: