Skip to content

feat: findBy repository shortcuts (Java 21) and reified Query results (Kotlin)#161

Merged
zantvoort merged 5 commits into
mainfrom
feat/find-by-and-reified-query-results
Jul 2, 2026
Merged

feat: findBy repository shortcuts (Java 21) and reified Query results (Kotlin)#161
zantvoort merged 5 commits into
mainfrom
feat/find-by-and-reified-query-results

Conversation

@zantvoort

@zantvoort zantvoort commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Description

New API conveniences for the next release (1.11.7) plus a documentation/skills accuracy pass.

Java 21 API (storm-java21):

  • findBy / getBy / findAllBy / findRefBy / findAllRefBy / getRefBy convenience default methods on EntityRepository and ProjectionRepository (@since 1.11), mirroring the Kotlin API.
  • Template-based groupBy / having / orderBy on QueryBuilder are now public (were protected).

Kotlin API (storm-kotlin):

  • Reified extensions on Query: resultList<T>(), singleResult<T>(), optionalResult<T>(), resultStream<T>(), resultFlow<T>() (@since 1.11), each delegating to the KClass-based methods. This makes the syntax advertised on the front page and docs — orm.query { ... }.resultList<User>() — actually compile. They coexist with the untyped resultList property (property access still resolves to the member).

Landing page:

  • Simplified the repository aggregate example to usersPerCity(country) (no orderBy/limit).
  • The sql scene now leads with plain SQL the QueryBuilder can't express (RANK() OVER), filtered by a $country bind variable and mapped to an ad-hoc data class; bind variables are annotated with inline SQL comments. The Show SQL panel mirrors both queries.

Docs (next) & skills:

  • Kotlin examples updated to the reified syntax (sql-templates.md, hydration.md).
  • Fixed Kotlin snippets that did not compile: error-handling.md used Java-style getSingleResult() / getOptionalResult(User::class) on QueryBuilder (now singleResult / optionalResult properties); security.md interpolated into a plain string passed to query(String) — not parameterized as claimed — now a template lambda.
  • Accuracy pass across the storm-* skills; skills no longer reference concrete Storm versions.
  • llms-full.txt regenerated from the current docs (was stale since March, hence the large diff).

Other:

  • Corrected the stale @since 1.12 tag on TransactionContext (that API shipped in 1.11.4).
  • Developer email updated in the parent POM.

The 1.11.6 versioned docs intentionally keep the resultList<User>() syntax and are left untouched; they become accurate when 1.11.7 is released.

Related Issue

None.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)

Checklist

  • My code follows the project's code style
  • I have added tests that cover my changes
  • All new and existing tests pass (mvn verify)
  • I have updated relevant documentation
  • My changes generate no new compiler warnings

Module(s) Affected

storm-java21, storm-kotlin, storm-core (javadoc only), website (landing page, docs, skills, llms-full.txt), parent POM

Breaking Changes

None. All API additions are backward compatible; widening groupBy/having/orderBy from protected to public is source- and binary-compatible.

… (Kotlin)

Java 21 API:
- Add findBy/getBy/findAllBy/findRefBy convenience default methods to
  EntityRepository and ProjectionRepository (since 1.12).
- Make template-based groupBy/having/orderBy public on QueryBuilder.

Kotlin API:
- Add reified extensions on Query: resultList<T>(), singleResult<T>(),
  optionalResult<T>(), resultStream<T>() and resultFlow<T>(), making the
  advertised orm.query { }.resultList<User>() syntax compile (since 1.12).

Docs & skills:
- Update Kotlin examples in the next docs to the reified syntax.
- Fix Kotlin snippets that did not compile (error-handling.md used
  Java-style accessors on QueryBuilder) or were not parameterized as
  claimed (security.md interpolated into a plain string instead of a
  template lambda).
- Skills accuracy pass across the storm-* skills; document the new
  reified extensions in storm-sql-kotlin and storm-query-kotlin.
- Regenerate llms-full.txt from the current docs.

Other:
- Update developer email in the parent POM.
@zantvoort zantvoort added this to the 1.12.0 milestone Jul 1, 2026
zantvoort added 4 commits July 2, 2026 08:07
Drop orderByDescending/limit from the repository aggregate example and
rename topCities(country, limit) to usersPerCity(country); align the
Show SQL panel accordingly.
Show plain SQL mapped to an ad-hoc data class (CityCount) before the
templated query, and add the passed-through SQL to the Show SQL panel.
Lead with plain SQL the QueryBuilder can't express (RANK() OVER),
filtered by a $country bind variable, mapped to an ad-hoc data class.
Annotate bind variables inline with SQL comments in both queries.
The next release is 1.11.7 rather than 1.12.0; @SInCE tags follow the
project's major.minor convention. Also corrects the stale @SInCE 1.12
on TransactionContext, which shipped in 1.11.4. Skill files no longer
reference concrete Storm versions.
@zantvoort zantvoort merged commit 3730629 into main Jul 2, 2026
7 checks passed
@zantvoort zantvoort deleted the feat/find-by-and-reified-query-results branch July 2, 2026 06:38
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