hi, is there any solution to map one object into another object without using foreign key? for example, something like bellow:
@Entity
@Table("tbl_a")
public class A extends BaseEntity {
@Formula("select c.id from tbl_b b, tbl_c c
where b.a_id = id
and b.c_id = c.id
and rownum = 1")
private C c;
}
@Entity
@Table("tbl_b")
public class B extends BaseEntity {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "a_id")
private A a;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "c_id")
private C c;
}
@Entity
@Table("tbl_c")
public class C extends BaseEntity {
@Column
private String title;
@Column
private String code;
}
note. i don’t wanna to map collection of B in A class. because i need just one row of C class!