I have an Entity A which is having an @OneToOne association on Entity B. When ever trying to update Entity A it is resulting in LazyInitializationException
@Entity
@Table(name = "A")
public class A {
private B b;
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "bId", foreignKey = @ForeignKey(name="FK_A_B_id"))
public B getb() {
return b;
}
public void setB(B b) {
this.b= b;
}
While trying to update Entity A with spring the Controller throws LazyInitializtionException. Entity B is an optional value in the table
Thanks for the help!!