0

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!

2
  • SqlResultSetMapping is used for mapping an sql result set... that is a jdbc ResultSet not the result of a jpa query. Commented 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. Commented Jun 24, 2022 at 14:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.