Hi,
I have two entities A and B with following details:
In A.java: A is associated with B through B_CODE. @ManyToOne(targetEntity = B.class, optional = false, fetch = FetchType.LAZY) @JoinColumn(name = "B_CODE", referencedColumnName = "B_CODE", nullable = false) private B b;
In B.java: B_CODE is not a key column in B. B_ID is Primary key. @Id @Column(name = "B_ID") private Long id;
@Column(name = "B_CODE", nullable = false) private String code;
In spite of defining the association in A as lazy, it is always loaded whenever A is queried. Is this because the association is with a non key column of B?
|