Skip to content

named queries, entity graphs, and result set mappings in static metamodel generation #459

Closed
@gavinking

Description

A very nice—and extremely underused—feature of the static metamodel is the ability to write:

@OneToMany(mappedBy=Item_.ORDER)
Set<Item> items;

which is a lot more typesafe than:

@OneToMany(mappedBy="order")
Set<Item> items;

But we could take this further. We could have the static metamodel include string-valued constants for named queries, named entity graphs, and even SQL result set mappings.

So you could write, for example:

em.createQuery(Book_.QUERY_ALL_BOOKS).getResultList();

Hibernate 6.3 already supports this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status

      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions