Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow nested result set mappings in @NamedNativeQuery #471

Closed
gavinking opened this issue Aug 19, 2023 · 0 comments · Fixed by #476
Closed

allow nested result set mappings in @NamedNativeQuery #471

gavinking opened this issue Aug 19, 2023 · 0 comments · Fixed by #476
Projects

Comments

@gavinking
Copy link
Contributor

gavinking commented Aug 19, 2023

The @SqlResultSetMapping annotation defines a named mapping, which is useful when you're passing a SQL query as a string to EntityManager.createNativeQuery().

But when you have a @NamedNatiiveQuery it's just annoying and untypesafe.

I therefore propose adding the following members to @NamedNatiiveQuery:

public @interface NamedNativeQuery { 

    ...

    /** Specifies the result set mapping to entities. */
    EntityResult[] entities() default {};

    /** 
     * Specifies the result set mapping to constructors. 
     */
    ConstructorResult[] classes() default {};

    /** Specifies the result set mapping to scalar values. */
    ColumnResult[] columns() default {};
}

Naturally, this is just a copy/paste job of the members of @SqlResultSetMapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
3.2.0
Done
Development

Successfully merging a pull request may close this issue.

1 participant