Skip to content

feat: generate one repository per named query group - #25

Merged
omer-cengel merged 2 commits into
masterfrom
feature/repository-per-query-group
Sep 24, 2026
Merged

omer-cengel merged 2 commits into
masterfrom
feature/repository-per-query-group

Conversation

@omer-cengel

Copy link
Copy Markdown
Member

Summary

Generated code now exposes one concrete repository per configured query group instead of one class per query, so an application constructs a single <Name>Repository per execution context and calls its typed query methods, rather than instantiating a separate type for every query.

Changes

  • Each sql configuration entry requires a Java-safe name; an entry named Author generates AuthorRepository.
  • All queries of an entry are analyzed first and passed to Java generation as an explicit query group, so grouping is never inferred from file paths or tables.
  • Each repository is a final class with one QueryExecutor field, one constructor, and one public method per named query in declared order, preserving parameter types, parameter order, selected-column order, and JDBC binding order.
  • Query-specific result records and row mappers are nested inside the repository.
  • Per-query generated classes are removed; there is no compatibility mode.
  • Query-name and method collisions are checked per repository and rejected before any file is written, including two queries whose nested result types differ only by case. Two repositories may reuse the same query name, and repository file collisions remain global within one output package.
  • The external Maven sample, release verification script, README, and configuration, query, PostgreSQL, and quickstart guides use the repository API.

Scope and non-goals

  • No generated repository interfaces, implementation suffixes, annotations, scanning, proxies, service locators, or repository factory.
  • No automatic grouping by table or filename and no inferred CRUD methods beyond the named SQL.
  • No new SQL constructs, types, transaction helpers, or runtime API changes; both existing JdbcQueryExecutor construction paths run the same generated repository.
  • Result types and cardinality behavior (:one, :many, :exec) are unchanged.

Each sql entry now requires a Java-safe name, and all queries of the entry
generate one final <Name>Repository with one QueryExecutor field, one
constructor, and one method per query in declared order. Result records and
row mappers are nested in the repository, and per-query classes are no longer
generated.

Query-name and method collisions, including nested result types that differ
only by case, are checked per repository before any file is written, so two
repositories may reuse a query name. Repository file collisions remain global
within one output package.
@omer-cengel
omer-cengel merged commit 5d43210 into master Sep 24, 2026
6 checks passed
@omer-cengel
omer-cengel deleted the feature/repository-per-query-group branch September 24, 2026 17:41
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