Skip to content

are Data repositories discoverable? #1000

@gavinking

Description

@gavinking

Currently we say:

A class is considered eligible for generation of a metamodel class if it **belongs to the persistence unit** and:
  • it is annotated with a discoverable annotation type, or
  • it has a method annotated with one of the two static query annotations,
    @StaticQuery or @StaticNativeQuery.

And:

The set of types **belonging to a persistence unit** is determined by:
  • classes bearing discoverable annotation types located in the root of the
    persistence unit (unless <exclude-unlisted-classes/> is specified);
  • one or more object/relational mapping XML files;
  • one or more JAR files to be searched for classes;
  • an explicit list of classes.

So a Jakarta Data repository does not "belong to the persistence unit" unless it's explicitly listed in persistence.xml or in an orm.xml, and therefore we are not required to generate a static metamodel for it, meaning it's @StaticQuery and @StaticNativeQuery annotations have no representation in the metamodel.

One fix would be to simply assert that @Repository is considered @Discoverable ... even though it's not annotated as such.

Also I think we should add Jakarta Data's @Query to the list of "static query annotations".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions