Uploaded image for project: 'Hibernate ORM'
  1. HHH-8615

Shared type parameters results in inconsistent internal model (especially with DynamicParameterizedType)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.6, 4.3.8
    • Fix Version/s: 5.0.0.CR4, 4.3.11
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      Looking at SimpleValueBinder.fillSimpleValue(), it is clear that the type parameters (a Properties instance) are shared between the type defs in the Mappings, the SimpleValue, and/or the SimpleValueBinder – no separate copies of these Properties instances are made anywhere, so changes to one reference are reflected in everybody's references (they're the same underlying Properties instance).

      This makes it possible for multiple entity properties to share the same type parameters, so that customizations to the type parameters for one entity property are (incorrectly?) reflected in the type parameters for a different entity property, perhaps belonging to a different entity altogether.

      This happened to us immediately when we tried to create a custom DynamicParameterizedType – see SimpleValue.getType(), which invokes createParameterImpl() only if the type parameters do not already have a PARAMETER_TYPE entry... but the type parameters may easily already have this parameter set, since the parameters are shared with other entity properties in the user model that may have already lazily initialized this entry.

      This may be related to HHH-7936 Closed , but I can't tell from the bug description.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                6 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 - 1.05h
                  1.05h