Hi all,
I have a problem, my code is:
@Entity public class A{
@ManyToOne(fetch = FetchType.LAZY, targetEntity = B.class) @JoinColumn(name = "b_id") public B b;
}
@Entity public class B{
private String id; private String description;
}
I have a service method:
public A XXX(A a){
//Search Entity A oldA= this.findById(a.getId())
//Load Entity this.loadA(oldA);//FROM A LEFT JOIN FETCH a.b WHERE A.id=:id
}
In the method loadA is where I have the problem because doesn´t load the property and then when I access a.getB().getDescription() throw LazyInitializationException.
I don´t understand because no load the property. Any suggestion???
Thank you in advance
|