I have 2 tables
- Cluster and
both having Bi directional MANY TO MANY relationship with a third table 3) Tag with respective intermediate tables named
- Cluster_Tag and
- EMR_LABEL_TAG , both with extra columns .
The bi directional mappings from both 1) Cluster and 2) EMRLabel to the Tag table has been done according to https://vladmihalcea.com/the-best-way-to-map-a-many-to-many-association-with-extra-columns-when-using-jpa-and-hibernate/
Initially, i had only the bi-directional mappings between Cluster and Tag tables done and it was working fine when using named queries etc but, after including the second bi directional relationship between EMRLabel and Tag table, I keep getting
java.sql.SQLSyntaxErrorException: Unknown column ‘tags1_.emrLabel_id’ in ‘on clause’
whenever I try to run a JPA query joining EMRLabel and Tag like SELECT c FROM EMRLabel c JOIN c.tags ct where ct.tag.tagName=:val1 order by c.priority DESC
i have checked multiple times the column names ,mappings involved but could not find anything wrong, but i am wondering is it because of the Tag entity now having 2 bi directional mappings 1) one to Cluster table and 2) now another to EMRLabel table, is that the issue ?