Skip to content

feat: honor projection aliases and generate camel-case Java names - #26

Merged
omer-cengel merged 3 commits into
masterfrom
feature/projection-aliases-and-camel-case-java-names
Sep 24, 2026
Merged

omer-cengel merged 3 commits into
masterfrom
feature/projection-aliases-and-camel-case-java-names

Conversation

@omer-cengel

Copy link
Copy Markdown
Member

Summary

Generated repositories now use conventional Java names and respect explicit projection aliases. Before this change, a SELECT alias was accepted but ignored, and snake_case SQL names leaked into generated components and parameters (created_at). Names are now derived from their SQL spelling by one deterministic camel-case rule set, so generated APIs read like ordinary Java and aliased joins produce meaningful component names.

Changes

  • An explicit alias on a directly selected column, in single-table and join queries, names that result column. Its Java type and nullability still come from the schema column.
  • Repository and result types use upper camel case (author_admin → AuthorAdminRepository, get_author → GetAuthorResult).
  • Methods, row-mapper fields, record components, and parameters use lower camel case (created_at → createdAt, HTTPStatus → httpStatus, GetHTTPStatus → getHTTPStatus).
  • SQL names are split into words at every character that is not a letter or digit. All-caps words such as ID and URL are treated as ordinary words, and names that would start with a digit gain a leading _.
  • A SQL name with no letter or digit is rejected with a diagnostic that names the query.
  • Keyword and literal suffixing, Object-member avoidance, numeric disambiguation, and the rejection of same-method and case-only result-type collisions are unchanged. Row mapping stays positional, and JDBC binding order and executable SQL are unchanged.
  • Entry names that differ only in the case of their first character now produce the same repository name and are rejected as a duplicate generated file before anything is written.
  • The configuration and query documentation describe the naming rules, alias handling, and updated diagnostics.

Scope and non-goals

  • RETURNING aliases remain rejected.
  • Aliases are resolved only in the projection. Other clauses, such as ORDER BY, reach the database as written.
  • There is no configurable naming strategy.
  • Reusable table-row records, result cardinality, and runtime executor changes are not part of this change.

Repository and result types use upper camel case, and methods, record
components, and parameters use lower camel case. SQL names are split at
every non-letter-or-digit character, all-caps words such as ID are treated
as ordinary words, digit-initial names gain a leading underscore, and a
name with no letter or digit is rejected. Keyword suffixing, numeric
disambiguation, and the same-method and case-only result-type rejections
are unchanged, and row mapping stays positional.
@omer-cengel
omer-cengel merged commit 3e25b7e into master Sep 24, 2026
6 checks passed
@omer-cengel
omer-cengel deleted the feature/projection-aliases-and-camel-case-java-names branch September 24, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant