Skip to content

Typed Criteria query API on JavaRepository (intent glue foundation) - #6050

Merged
delchev merged 1 commit into
masterfrom
intent-glue-typed-find
Jun 19, 2026
Merged

Typed Criteria query API on JavaRepository (intent glue foundation)#6050
delchev merged 1 commit into
masterfrom
intent-glue-typed-find

Conversation

@delchev

@delchev delchev commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

What

Adds a typed, fluent Criteria query API to the client-Java JavaRepository, so glue and hand-written client code can filter rows type-safely instead of hand-writing HQL.

repository.findAll(Criteria.create()
    .lt("dueOn", today)
    .eq("status", "ACTIVE")
    .orderByDesc("dueOn"));

This is the query surface the declarative-glue catalog needs — e.g. a scheduled "find overdue loans" activity (see engine-intent/CLAUDE.md"Planned: declarative glue", Tier 1 #3).

How

  • Criteria (in data-store-java's repository package, next to JavaRepository — the package client code already imports from): eq/ne/gt/ge/lt/le/like/between/in/isNull/isNotNull + orderByAsc/Desc. Renders to an HQL fragment + a named-parameter map.
  • Safe by construction: values are bound as named parameters (never inlined); property names are validated to plain (optionally dotted) identifiers, so eq("status; drop table", …) throws.
  • JavaRepository.findAll(Criteria)JavaEntityStore.findAll(type, criteria), which builds from <entityName> … and reuses the existing map-projection query(...) path (returns typed T). No new Hibernate plumbing, no new module dependency.

Testing

CriteriaTest (4 cases, unit-level, no DB) covers AND-combination + parameter binding, BETWEEN/IN/null checks, and the injection-rejection guard. Run green locally (Tests run: 4, Failures: 0).

🤖 Generated with Claude Code

Adds a small fluent Criteria builder (eq/ne/gt/ge/lt/le/like/between/in/
isNull/isNotNull + orderBy) and JavaRepository.findAll(Criteria), the
type-safe alternative to hand-writing HQL. Criteria renders to an HQL
fragment plus a named-parameter map (values are bound, never inlined;
property names are validated to plain identifiers to prevent injection) and
runs through JavaEntityStore's existing map-projection query path.

This is the query surface the intent declarative-glue catalog (e.g. a
scheduled "find Loans where dueOn < today and status = ACTIVE") uses instead
of raw HQL. Covered by CriteriaTest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@delchev
delchev merged commit a656240 into master Jun 19, 2026
19 of 20 checks passed
@delchev
delchev deleted the intent-glue-typed-find branch June 19, 2026 16:29
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