Repository navigation
fix(hibernate5): apply maxSize and type text to Map, List and Set element columns - #16923
borinquenkid wants to merge 3 commits into
Conversation
…ment columns A mapped type: 'text' on a basic collection failed with "user collection type class not found: text" because the type name was handed to Hibernate as a user collection type. Basic collections no longer name a collection type, and the element column now honors maxSize and inList. Relates to #16897 Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
jamesfredley
left a comment
There was a problem hiding this comment.
Not approving. A collection's maxSize now limits each element's length, and a collection inList whose allowed values are collections prevents startup.
…pe, not the length from maxSize or inList The maxSize of a collection bounds the number of its elements, and its inList lists whole collections, so neither is the length of an element. A List of String named body with maxSize 2 is valid with the value ['abcdef'], because it has one element, and saving it failed on a varchar(2); an inList of lists, such as [['abcdef']], was read as element strings and stopped the mapping from being built. The column of the elements of a list, a set or a map is left to the type the mapping gives it: type text is mapped as text, and the length stays what it was otherwise. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
@jamesfredley Both are addressed in the new commit, and it removes the sizing from
What stays is the fix for The Hibernate 5 module (696 tests) and Branch policy: this commit adds no public type, no throw, and no schema change beyond the If you find another shape that does not reproduce first time, a failing spec on a throwaway branch, or the few lines you ran, would help me a lot. |
|
@jdaugherty: |
jamesfredley
left a comment
There was a problem hiding this comment.
The items this review found have been addressed. A collection's maxSize no longer limits each element, and an inList whose allowed values are collections no longer stops startup.
The 7.0.x patch line takes no more fixes after the 2026-11-25 releases; this PR moves to 7.2.x. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
Moved to 7.2.x: after the 2026-11-25 releases the 7.x line takes fixes on 7.2.x only. The branch has 7.2.x merged in and its module tests and codeStyle pass on it. Nothing else changed, so the review so far still applies; a fresh approval on the new head is needed for the merge rule. |
✅ All tests passed ✅Test SummaryTip Inspect all details with the TestLens CLI: CI / Functional Tests (Java 25, indy=false) > :grails-test-examples-datasources:integrationTest
🏷️ Commit: e11203d Test FailuresOsivRequestSessionSpec > a task a request returns lazily loads associations of the entities its action loaded (:grails-test-examples-datasources:integrationTest in CI / Functional Tests (Java 25, indy=false) | Attempt 1/2)Learn more about TestLens at testlens.app/docs. |
sbglasius
left a comment
There was a problem hiding this comment.
This is an AI assisted review
Skipping the collection type name for basic collections fixes type: 'text', and the spec pins maxSize/inList leaving the element column alone. The OsivRequestSessionSpec failure looks unrelated. LGTM.
|
Moved to 7.0.x as #17270: the bug is also on 7.0.x, the oldest branch with it. The change is rebuilt there on a new branch, so the approval here does not carry over. Closing this one; its review history stays here. |
Hibernate 5 counterpart of #16922 (8.0.x), for #16897.
Problem
type: 'text'on a basic collection (Map, List or Set of simple values) failed metadata build withuser collection type class not found: text, because the type name was passed to Hibernate as a user collection type.Change
CollectionType.getTypeNamereturns null for basic collections, so the mapped type is no longer treated as a collection type class.maxSizeandinListdo not size the element column. For a collection,maxSizeis the number of its elements andinListlists whole collections, so aListofStringwithmaxSize: 2is valid with one element of any length.Tests
MapElementColumnSpec: default length,maxSizeleaving the element length alone,type: 'text'on Map and List, aninListof lists, a list withinmaxSizethat is saved, the join column name, and the unchanged key column.Not covered
sqlTypeis not expressible in the mapping DSL.maxSizecannot give it, and no mapping setting does yet; see A joinTable column given as a map becomes the column name, and there is no way to set the length of a collection element column #17025.https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL