I would like to get the result of this SQL query in an entity:
SELECT * FROM thethreads t
LEFT JOIN thread_votes tv
ON t.idthread=tv.thread
AND tv.from_user like "currentUser";
Note that the joined result isn't part of my thethreads table:
I've tried this :
private static final String SELECT_NEWEST_THREADS = "Select t From Thethread t LEFT JOIN FETCH t.threadcurrentUserVote tv WHERE tv.user1=:currentUser ORDER BY t.datePosted";
and I've added this to my Thethread entity (which isn't a column in my table):
@OneToOne
private ThreadVote threadcurrentUserVote;
but I get an error :Unknown column 't1.THREADCURRENTUSERVOTE_id_votes_thread' in 'field list'
The purpose is to see if the user visiting a thread has already voted it or not.
Aucun commentaire:
Enregistrer un commentaire