could not read column value from result set
Why not try turning the association around and define it as a @ManyToOne
association in ColAgreementLinkageEJB3
, and then define the @OneToMany
as a 'mappedBy' relationship?
So your ColAgreementLinkageEJB3
would contain:
@Column(name = "AGREEMENT_ID")private Long agreementId;@ManyToOne(fetch = FetchType.LAZY, optional = true)@JoinColumn(name = "AGREEMENT_ID", referencedColumnName = "ID", insertable = false, updatable = false)private ColAgreementHeaderEJB3 header;
Note, you don't need to put the insertable/updatable parameters on the column definition.
And your ColAgreementHeaderEJB3
Entity would contain:
@OneToMany(mappedBy = "header", fetch = FetchType.LAZY)private Set<ColAgreementLinkageEJB3> linkageSet;
Also, you do not need the @NotFound
annotation as a one-to-many relationship is essentially one-to-zero-or-many.
If you want to always load the set of linkages, you would make the FetchType EAGER.