How to select just the foreign key value using Criteria Query?
问题 Suppose I have two entities as: @Entity public class A { @Id private int id; @ManyToOne private B b; //more attributes } @Entity public class B { @Id private int id; } So, the table for A is having a column as b_id as the foreign key. Now, I want to select just the b_id based on some criteria on other fields. How can I do this using criteria query? I tried doing following which throws IllegalArgumentException saying "Unable to locate Attribute with the given name [b_id] on this ManagedType [A