Hello.
I'm using jpa + hibernate (3.3.2.GA).
I mapped relations as follows:
-------------------------------
Code:
public class A {
...
@OneToOne(
optional = true,
cascade = {CascadeType.PERSIST, CascadeType.REFRESH },
fetch = FetchType.LAZY,
mappedBy = "a" )
private B b = null;
...
}
public class B {
...
@ManyToOne(
optional = false,
cascade = {CascadeType.PERSIST, CascadeType.REFRESH },
fetch = FetchType.LAZY
)
@JoinColumn (name = "ID_A", unique = true)
private A a= null;
...
}
-------------------------------
When I consult the entity "a", made just after the query corresponding to "b".
select ... from A ...
select ... from B ...
Why does not lazy load?
I tried also with the labels:
----------------------
Code:
@ LazyToOne (LazyToOneOption.PROXY)
@ org.hibernate.annotations.Fetch (FetchMode.SELECT)
----------------------
and I do not work. ¿Why?
Thank you!