I can't map this association with one-to-one:
tableA (
id, cod2)
tableB(
cod1,
cod2, description)
As you can see
tableA misses a column (I mean "cod1") to reference tableB in a one-to-one association. Anyway this is ok because I know at design-time the value of this column. So I tried this solution:
Code:
@Entity
public class EntityA {
...
@OneToOne
@JoinColumn(name="cod2", referencedColumn="cod2")
@Where("cod1=834")
private EntityB b;
}
But the where clause is not allowed in a one-to-one association, and also Hibernate complains about a missing join column because EntityB has a composite id.
How am I supposed to map this schema?