Skip to content

[clarification]: Shall We Introduce an Annotation to Mark Projection Records, or Leave It to Jakarta Data Providers? #1141

@otaviojava

Description

@otaviojava

Specification

https://github.com/jakartaee/data/blob/main/api/src/main/java/jakarta/data/repository/Find.java

I need clarification on ...

Jakarta Data supports projections using Java records with @Select to map entity attributes:

public record Name(String firstName,
                   String middleName,
                   @Select("lastName") String surname) {}

Currently, there is no annotation to explicitly declare a record as a projection target. This creates ambiguity for annotation processors and tooling that aim to generate metadata or validate mappings at compile time.

Should Jakarta Data define a dedicated annotation (e.g., @Projection) to mark these records as intended for projections, or should it be left to individual Jakarta Data providers to infer and handle this as needed?

This would not impact runtime behavior but would enhance compile-time clarity and tooling support.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions