If you want an object with name you can use something like
Copy code
@Query("select new com.packageName.SomeDTO(field, field, field, name) from ...")
xantier
09/11/2017, 9:17 AM
Actually, this probably won't work with nativequery.
n
noone
09/11/2017, 4:19 PM
lol, I'm so confused. if let's say you would to do this? Is there easier way? How would you do it?
x
xantier
09/11/2017, 5:26 PM
haha, yeah sorry. I spouted some nonsense first and then work took over and I forgot the whole thing. Watch this space...
👍 1
xantier
09/12/2017, 6:12 AM
You have at least 3 options to achieve that now. Adding a direct dependency to the users entity and using JPAQL to map that directly to the DTO with @Query and
. I'd go with number 1 first if there is nothing preventing you adding that dep (like attempts to a bounded context), if that's not possible I'd go with number 3.
n
noone
09/13/2017, 2:29 PM
Thank you sir, much appreciated I will explore and let you know.