Hibernate one to one with multiple columns
- by Erdem Emekligil
How can i bind two columns, using @OneToOne annotation?
Lets say I've 2 tables A and B.
Table A:
id1 (primary key)
id2 (pk)
other columns
Table B:
id1 (pk)
id2 (pk)
other columns
In class A i want to write something like this:
@OneToOne(fetch = FetchType.EAGER, targetEntity = B.class)
@JoinColumn(name = "id1 and id2", referencedColumnName = "id1 and id2")
private B b;
Is it possible to do this using annotations?
Thanks.