fatti stampare la query che generi e vedi che errore ha così puoi correggere quella classe che hai fatto