I have a bidirectional @OneToOne
relationship between A
and B
. A
owns the relationship. So, in A.java
:
@OneToOne // no need for mappedBy here because A owns this relationship
private B b;
And in B.java
:
@OneToOne(mappedBy = "b") // A's "b" field owns this relationship
private A a;
What are my fetch type options here? Can they be different on each side? That is, can I specify A
's relationship to eagerly fetch the associated B
, while telling B
to lazily fetch the associated A
?
Or, related: if i put fetch = FetchType.EAGER
on B#a
, is it respected? Under what circumstances?