Bag versus List #4539
Replies: 4 comments 5 replies
-
|
For the historical record, I was able to isolate this choice through Changing the default, if/when we decide to, is simply a matter of changing that one piece of code. |
Beta Was this translation helpful? Give feedback.
-
|
We'll maybe they want to use id-bag by default. And that is not particularly easy to support here. This only affects attributes defined as And in general, I think this notion of using a Java class as a 1-1 correlation to a classification is just not right. The classification is unambiguous unlike some of the Java types. |
Beta Was this translation helpful? Give feedback.
-
I mean this is all a new feature. In 5.x you cannot configure how Hibernate should handle this |
Beta Was this translation helpful? Give feedback.
-
|
We decided to revert back to BAG by default but the setting is still there so that users can switch to LIST by default. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Historically Hibernate interpreted a
Listattribute with out any explicit "index details" (@OrderColumn,@ListIndexBase, ...) using bag-semantics. JPA however requires this to be interpreted using list-semantics with default index details. To account for this initially we addedJpaCompliance#isJpaListComplianceEnabled.For 6.0 I propose we change this to:
Listtyped attributes, we interpret that as list-semanticsCollection(non-List) typed attributes, we interpret that as bag-semanticsThis has a wide impact. Heck, I made this change by accident working on
@CollectionTypesupport and quite a few of our tests fail. So we do need to think through migration. (1) and (2) above would be the default behavior with the following configuration points:@Bagannotation to allow marking aListas a bag.@CollectionSemanticannotation along the lines of@CollectionType#semantics- this is beyond just the List/Bag discussion, but has an impact hereJpaCompliance#isJpaListComplianceEnabledtotrue. If users explicitly set that tofalse, we would fallback to the current interpretation. It would no longer strictly be a JPA-compliance choice, but since that infrastructure exists already...Beta Was this translation helpful? Give feedback.
All reactions