Skip to content

HHH-15125 - Add ANTLR-based SQL formatter implementation#12268

Closed
jrenaat wants to merge 81 commits into
hibernate:7.4from
jrenaat:HHH-15125_SQLFormatter
Closed

HHH-15125 - Add ANTLR-based SQL formatter implementation#12268
jrenaat wants to merge 81 commits into
hibernate:7.4from
jrenaat:HHH-15125_SQLFormatter

Conversation

@jrenaat
Copy link
Copy Markdown
Member

@jrenaat jrenaat commented Apr 29, 2026

Implement TokenBasedFormatterImpl as an improved SQL formatter using
ANTLR for tokenization.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.



Please make sure that the following tasks are completed:
Tasks specific to HHH-20415 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20412 (Remove Feature):

  • Add test OR check there is no need for a test
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20375 (Task):

  • Add test OR check there is no need for a test
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20374 (New Feature):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20369 (New Feature):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20368 (New Feature):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20362 (New Feature):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20295 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20141 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20139 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20135 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20134 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20097 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20083 (Remove Feature):

  • Add test OR check there is no need for a test
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20062 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-20028 (Task):

  • Add test OR check there is no need for a test
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-19951 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-19933 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-19567 (Bug):

  • Add test reproducing the bug
  • Add entries as relevant to migration-guide.adoc OR check there are no breaking changes

Tasks specific to HHH-19509 (Improvement):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-15125 (New Feature):

  • Add tests for feature/improvement
  • Update documentation as relevant: javadoc for changed API, documentation/src/main/asciidoc/userguide for all features, documentation/src/main/asciidoc/introduction for main features, links from existing documentation
  • Add entries as relevant to migration-guide.adoc (breaking changes) and whats-new.adoc (new features/improvements)

Tasks specific to HHH-9912 (Bug):

  • Add test reproducing the bug
  • Add entries as relevant to migration-guide.adoc OR check there are no breaking changes

https://hibernate.atlassian.net/browse/HHH-15125

@jrenaat jrenaat force-pushed the HHH-15125_SQLFormatter branch 5 times, most recently from 2fa8075 to 74b2ad7 Compare May 6, 2026 17:10
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
66.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

sebersole added 24 commits May 7, 2026 11:01
HHH-20074 - Adapt Hibernate Query contracts to new JPA 4.0 structure
HHH-20074 - Adapt Hibernate Query contracts to new JPA 4.0 structure
HHH-20074 - Adapt Hibernate Query contracts to new JPA 4.0 structure
HHH-20074 - Adapt Hibernate Query contracts to new JPA 4.0 structure
HHH-20074 - Adapt Hibernate Query contracts to new JPA 4.0 structure
HHH-20074 - Adapt Hibernate Query contracts to new JPA 4.0 structure
sebersole and others added 23 commits May 7, 2026 11:05
Address compilation errors with CriteriaBuilder, mostly regarding -

* and() / or() method signatures
* creating criteria from JPQL

Signed-off-by: Steve Ebersole <steve@hibernate.org>
Address compilation errors with JpaCriteriaQuery and friends

Signed-off-by: Steve Ebersole <steve@hibernate.org>
Address compilation errors with JpaCriteriaQuery and friends

Signed-off-by: Steve Ebersole <steve@hibernate.org>
Add test data clean up to hopefully address odd edb CI failure.

Signed-off-by: Steve Ebersole <steve@hibernate.org>
Signed-off-by: Steve Ebersole <steve@hibernate.org>
Signed-off-by: Steve Ebersole <steve@hibernate.org>
Signed-off-by: Steve Ebersole <steve@hibernate.org>
…ds of the same type

Signed-off-by: Steve Ebersole <steve@hibernate.org>
…and owned associations

Signed-off-by: Steve Ebersole <steve@hibernate.org>
…QL AST

Signed-off-by: Steve Ebersole <steve@hibernate.org>
Signed-off-by: Steve Ebersole <steve@hibernate.org>
Signed-off-by: Steve Ebersole <steve@hibernate.org>
    Implement TokenBasedFormatterImpl as an improved SQL formatter using
    ANTLR for tokenization.

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
@jrenaat jrenaat force-pushed the HHH-15125_SQLFormatter branch from 74b2ad7 to 4529479 Compare May 8, 2026 21:35
@hibernate-github-bot hibernate-github-bot Bot added the 7.4 Label for pull requests targeting [7.4] branch. label May 8, 2026
@hibernate-github-bot
Copy link
Copy Markdown

Thanks for your pull request!

This pull request does not follow the contribution rules. Could you have a look?

❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
    ↳ Offending commits: [49b0e19, 9b7bc42, 7565cce, 3f866bd, a115b24, 68b7f5b, bf2bebf, b377c5e, d62b3e1, 6c795a8, 6351790, 9d97189, e887577, b684788]

› This message was automatically generated.

@hibernate-github-bot
Copy link
Copy Markdown

Thanks for your pull request!

This pull request does not follow the contribution rules. Could you have a look?

❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
    ↳ Offending commits: [49b0e19, 9b7bc42, 7565cce, 3f866bd, a115b24, 68b7f5b, bf2bebf, b377c5e, d62b3e1, 6c795a8, 6351790, 9d97189, e887577, b684788]
❌ The PR title or body should list the keys of all JIRA issues mentioned in the commits
    ↳ Issue keys mentioned in commits but missing from the PR title or body: [HHH-20028, HHH-20134, HHH-20083, HHH-19951, HHH-19567, HHH-20097, HHH-20135, HHH-20062, HHH-9912, HHH-20141, HHH-20139, HHH-20295, HHH-20375, HHH-20368, HHH-20362, HHH-20369, HHH-20374, HHH-19933, HHH-20412, HHH-20415, HHH-19509]

› This message was automatically generated.

@jrenaat jrenaat closed this May 11, 2026
@jrenaat jrenaat deleted the HHH-15125_SQLFormatter branch May 11, 2026 15:18
@jrenaat
Copy link
Copy Markdown
Member Author

jrenaat commented May 11, 2026

Messed up in a rebase somewhere. Will recreate the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.4 Label for pull requests targeting [7.4] branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants