Just a quick question. Want to join two tables A and B, where a_fk is A’s table foreign key and b_pr is B’s primary key. Relation between A and B is one-to-one bidirectional.
A and B are corresponding to A and B table Entity classes.
I have jpql query "select b from A a, B b where a.a_fk=b.b_pr"; Eclipse fails to compile saying that column a_fk does not exist.
I have created a Native sql query and checked the same sql statement, but of course I have translated it to proper sql. And this works.
Question: JPQL does not support foreign keys?
JPQL uses entities and association between entties. It doesn’t use tables, column and foreign keys.
If you want to select all As which have a B, the query is
If you want to select all As with their B
Read a book about JPA, because you haven’t grasped basic concepts about JPA.