I got in DB tables:
a) rb_user:
id_user, username, …
b) rb_user_password:
id, user_id, password.
How to annotate this in my java classes? I got:
@Entity
@Table(name="rb_users")
@SecondaryTable(name="rb_user_password")
public class User {
@Id
@Column(name="id_user")
private int id;
private String name;
...
@Column(table="rb_user_password", name="password")
private String password
I got these exception:
org.postgresql.util.PSQLException: ERROR: column user0_1_.id_user does
not exist
I know its because I got primary key “id_user”, and in my table with password column name is “user_id”
You can specifiy the name of the attribute in the secondary table with the
pkJoinColumnsattribute on@SecondaryTable.