Hi All,
I have a PO table for purchase details which contains a column for storing carrier. I store carrier id in the column and this can be null because some PO may not have carrier. I have created entity PO as shown below. When I try to display the list of PO I am getting an error javax.persistence.EntityNotFoundException: Unable to find...
When i debug my List I found if the carrier field in is null (it actually not null it ' ' single space in table and something like java_assist_12... in PO object). Then I tried to print this value in my Action class I found when i call say po.carrier.name an exception is occurring.
If I remove fetch = FetchType.LAZY then I could not get any result. I don’t understand why it is not working in either case.
Anybody have any idea. I believe foreign key in table can be null.
Code:
public class Po implements java.io.Serializable{
.
.
private Carrier carrier = new Carrier();
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns ({
@JoinColumn(name="LOC",nullable=true, referencedColumnName = "LOC", insertable=false, updatable=false),
@JoinColumn(name="CARRIER",nullable=true, referencedColumnName = "CARRIER", insertable=false, updatable=false)
})
public Carrier getCarrier() {
return this.carrier;
}
.
.
.}
Please Help
Fabian