For some reason I'm getting null returned from my database through Spring data JPA and I'm not quite sure why because when I run the query in Postgres it works fine. I'd really appreciate someone taking a look at the code if they've a few minutes to spare.
The error is:
which implies that nothing is getting returned from the database. This is the controller:
This is the corresponding query in the repository:
The data transfer object I'm using
Let me know if you need more code or have any questions about it.
@Rob, first thanks for answering. I've been trying stackoverflow to no avail. To answer your question, yeah it's definetly in the database. If you've any more ideas about what is causing the error I'd really love to hear them.
Also, just to clarify. Despite it being called FriendList it doesn't return a list. Poor naming on my part. I have a different query that returns a list as shown below but in this case I just want to return a single row of data from the database. Also, I want to note that the below query that returns a list works fine.
@Rob, I got it working. Thanks for the help anyway though it was really appreciated. I think it may have been to do with the SQL Query and the JOIN I was using. If I figure out what was causing the problem for sure I'll leave a reply here to make sure anyone else who runs into the same problem can see why it happened to me.