For a normal many-to-one, I can just do
Code:
public class FirmUser implements Serializable{
private Login logn;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "username")
public Login getLogin() {
return login;
}
public void setLogin(Login login){
this.login = login;
}
The above mapping would use the primary key column of Login entity. However, what if I want it to be mapped to another column in Login, how could I do that?
I think we can achivev that with mapping files, but not sure if it's possible with hibernate annotation.