Skip to content
Advertisement

Spring Data JPA – Custom Native Query-Methods list prints java.lang.Object

I have created a native custom query method:

And calling EntityManager with:

But all I get is:

when I print out the list. Number of objects is correct so I assume something with casting is not correct. I do get a warning in my IDE:

Why is this happening and how do I get the correct list?

Advertisement

Answer

You can use the expected type in the createNativeQuery method like below,

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement