I have a situation where I am making a read request to a database with a long, complex query that needs to map to a complex object. Based on my research, it looks like I want to use @SqlResultSetMapping to handle the mapping, but I would like to put my query into the jpa-named-queries.properties file because it is so long. I can only find examples of @SqlResultSetMapping with @NamedNativeQuery that shows the query passed into the query parameter of the annotation as a string. Is it possible to use @SqlResultSetMapping with an externalized query, and if so, can anyone provide and example of how to do this? Thanks!
-
SqlResultSetMapping is used for mapping an sql result set... that is a jdbc ResultSet not the result of a jpa query.Michael Wiles– Michael Wiles2022-06-24 13:51:32 +00:00Commented Jun 24, 2022 at 13:51
-
Hi @michael-wiles. Thanks for the reply. I might have some of my terminology wrong. Basically, this is the sort of think I am trying to acheive. But I'd like that query in the NamedQuery annotation to be externalized. Currently I have it in a properties file, and if I have a repository method named the same as the query, it picks it up. But I can't handle the mapping that way.Nathan Coates– Nathan Coates2022-06-24 14:05:42 +00:00Commented Jun 24, 2022 at 14:05
Add a comment
|