fix: align H7 HibernateGormStaticApi internal SQL method names with H5#15768
fix: align H7 HibernateGormStaticApi internal SQL method names with H5#15768borinquenkid wants to merge 5 commits into
Conversation
Rename findWithNativeSql/findAllWithNativeSql to findWithSql/findAllWithSql in HibernateGormStaticApi so the Native suffix is not visible outside the implementation. HibernateEntity already exposes the correct public names; only the internal delegation calls are updated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Hibernate 7 GORM static API to use findWithSql / findAllWithSql method names (matching the Hibernate 5 naming) and adjusts HibernateEntity to delegate to those updated method names.
Changes:
- Renamed
HibernateGormStaticApiinternal native-SQL methods fromfindWithNativeSql/findAllWithNativeSqltofindWithSql/findAllWithSql. - Updated
HibernateEntitytrait delegation calls to match the renamed static API methods.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/HibernateGormStaticApi.groovy | Renames the static API native SQL method names to *WithSql. |
| grails-data-hibernate7/core/src/main/groovy/grails/gorm/hibernate/HibernateEntity.groovy | Updates trait delegation to call the renamed HibernateGormStaticApi methods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
matrei
left a comment
There was a problem hiding this comment.
The documentation also needs updating.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #15768 +/- ##
==================================================
- Coverage 49.2583% 49.2540% -0.0043%
+ Complexity 16506 16502 -4
==================================================
Files 1941 1941
Lines 92023 92023
Branches 16062 16062
==================================================
- Hits 45329 45325 -4
- Misses 39649 39655 +6
+ Partials 7045 7043 -2 🚀 New features to boost your workflow:
|
We never exposed this to the public we have not release a milestone. I am very confused. |
Keep Hibernate 7 SQL helper documentation aligned with the historical Hibernate 5 GORM API names findWithSql and findAllWithSql. Remove the unreleased NativeSql method names from the H7 guide and keep the static API signature wording consistent. Assisted-by: opencode:openai/gpt-5.5
|
Pushed follow-up commit 92b2c98. This keeps the H7 SQL helper API aligned with the historical Hibernate 5/GORM names: Verified with JDK 21:
|
|
@borinquenkid @matrei I believe this is all polished up. |
| GORM provides `findWithSql` and `findAllWithSql` for executing raw SQL when HQL or the Criteria API cannot express the query you need (e.g. database-specific functions, complex joins, or legacy SQL). | ||
|
|
||
| WARNING: Native SQL bypasses Hibernate's type system and object mapping. Prefer HQL, the Criteria API, or dynamic finders wherever possible. Use native SQL only when there is no higher-level alternative. | ||
| WARNING: Raw SQL bypasses Hibernate's type system and object mapping. Prefer HQL, the Criteria API, or dynamic finders wherever possible. Use SQL only when there is no higher-level alternative. |
There was a problem hiding this comment.
Shouldn't this say DetachedCriteria?
There was a problem hiding this comment.
I agree, we dont use JPA Criteria , we use GORM DetachedCriteria
| ===== SQL query helpers | ||
|
|
||
| `findWithSql` and `findAllWithSql` are deprecated. Use `findWithNativeSql` and `findAllWithNativeSql` instead. The old names remain as delegating aliases for backwards compatibility. | ||
| Hibernate 7 keeps the Hibernate 5 method names for raw SQL query helpers: |
There was a problem hiding this comment.
Why do we need to mention this?
Removed mention of Hibernate 5 method names for raw SQL query helpers.
✅ All tests passed ✅🏷️ Commit: 1e57996 Learn more about TestLens at testlens.app. |
Rename findWithNativeSql/findAllWithNativeSql to findWithSql/findAllWithSql in HibernateGormStaticApi so the Native suffix is not visible outside the implementation. HibernateEntity already exposes the correct public names; only the internal delegation calls are updated.
Description
Contributor Checklist
Please review the following checklist before submitting your pull request. Pull requests that do not meet these requirements may be closed without review.
Issue and Scope
7.0.x): Bug fixes only. No new features or API changes.7.1.x): New features are welcome, but breaking existing APIs must be avoided.8.0.x): Reserved for major changes. Breaking API changes are permitted.Code Quality
./gradlew build --rerun-tasks../gradlew codeStyleand resolved any violations. See Code Style for details.Licensing and Attribution
Documentation