borinquenkid commented on PR #16344: URL: https://github.com/apache/grails-core/pull/16344#issuecomment-5745544755
A narrow, unrelated fix in `e635ada746`: `id generator: 'sequence'` with no explicit `params: [sequence: '...']` crashed session factory bootstrap on Hibernate 7 with `Unable to determine implicit sequence name for target table 'null'`. **Root cause.** Hibernate's own generator-creation path supplies the target table so its naming strategy can derive an implicit sequence name when none is given. `GrailsSequenceStyleGenerator` constructs Hibernate's `SequenceStyleGenerator` directly and never supplied it, so the implicit-naming fallback had nothing to work with. Every existing test for this generator sidestepped the bug by passing an explicit sequence name - one already carried a comment saying as much. **Fix.** Supply the target table (`context.getRootClass().getTable().getName()`) before calling `configure()`, guarded to only run when no explicit sequence name is present, so `getRootClass()` is never called where it isn't needed (e.g. the existing mocked unit tests). **Coverage.** New implicit-naming regression tests in `SequenceGeneratorsSpec` and `Issue16349Spec` (confirming the dirty-checking fix already covers the sequence generator too), and two existing `GrailsSequenceStyleGeneratorSpec` unit tests fixed to stub `getRootClass()` now that it's consulted. Verified against the pre-fix code that the new tests actually catch the regression. Full `grails-data-hibernate7-core` suite: 3239/3239 passing. Documented as upgrade note 71 in `upgrading80x.adoc`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
