There are two tables: bb_players and bb_player_skills. player skills table has one to one relation with bb_players, and also foreign key to bb_players.
Error happens at executing this code:
Query q = em.createNamedQuery(PlayerSkill.DELETE_SKILL_BY_PLAYER_ID);
q.setParameter("playerID", playerID);
q.executeUpdate();
The named query is:
@NamedQuery(name = PlayerSkill.DELETE_SKILL_BY_PLAYER_ID, query = "DELETE FROM PlayerSkill s " +
" WHERE s.player.id = :playerID")
The error from postgresql logs is:
ERROR,42601,"syntax error at or near ""cross""",,,,,,
"delete from bb_player_skills cross join bb_players player1_ where id=$1",30,,""
Is my named query wrong and how should I rewrite it?
session.delete()to delete it. And Hibernate would create the query by itself without your help.