Bryan Carty

Greenhorn
+ Follow
since Mar 28, 2021
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
5
Given in last 30 days
5
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bryan Carty

Yeah, doing a left join fixed it. Thanks again. Your help was really appreciated.
1 week ago
@Bear thanks for the in depth answer. Very much appreciated. I'll definitely refer back to it after reading up more on thymeleaf jquery etc.
From the posts I've read it doesn't seem possible to append/prepend a thymeleaf attribute using jquery such as the one below. But I'm wondering if there's any way around it. If so I'd be really grateful if you could specify how.

For example I have the below code but it isn't working because ThymeLeaf is compiled on the server while jquery is processed at the client.

Is there a way around this?

This is the code:



To elaborate on why I want to do this:

I have a table in a web application that displays the logged in users friends(left). The logged in user can add/remove friends by searching them in a search bar on the application. The below screenshot might help.



When a user searches for a friend in the right hand side search bar and adds them by clicking the heart icon I add a row to the table using jquery after acquiring the necessary data with ajax.

The problem is that this row contains thymeleaf attributes such as th:href. For example when the logged in user clicks on a friends name in the table it brings the user to the profile page of the friend.

However, thymeleaf attributes don't seem to work when appended/prepended with jquery in this way.

Would really appreciate some help.

Thanks
@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.

Thanks again
1 week ago
@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.

1 week ago
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.

Thanks again
1 week ago