Hibernate Annotations, creating a 3rd entity from existing two entities without annotating an already annotated table
I have two tables named USER and ROLE with objects using USER and ROLE. Now I want to create another object using this above entity so that I can get data from both tables.
Another table is called USER_ROLE, which contains two fields: "user_id" and "role_id".
I need to accomplish this thing using hibernate annotations.
I tried to create a third object with annotated table as USER table and properties are some fields of USER table and Collection of ROLE table. But the error here is that I have annotated the third object with the USER table, which is already being annotated with the custom object.
So now I have to make this third object without annotating any table, I have to access two objects that are already accessing the table.
how can i accomplish them using hibernate annotations.
kindly help me on this issue
source to share