I have following piece of code..
working fine (staffTbl
is not getting fetch lazily)
@OneToOne(fetch=FetchType.LAZY)
@JoinColumns({@javax.persistence.JoinColumn(name="inst_id", referencedColumnName="inst_id", insertable=false, updatable=false), @javax.persistence.JoinColumn(name="staff_id", referencedColumnName="staff_id", insertable=false, updatable=false)})
private StaffTbl staffTbl;
but when I made this transient its always fetching null:
@OneToOne(fetch=FetchType.LAZY)
@JoinColumns({@javax.persistence.JoinColumn(name="inst_id", referencedColumnName="inst_id", insertable=false, updatable=false), @javax.persistence.JoinColumn(name="staff_id", referencedColumnName="staff_id", insertable=false, updatable=false)})
private transient StaffTbl staffTbl;
Is there any mistake?
(I'm using Hibernate 3, with JBoss 6.1)
Is there any mistake?
if a field has marked as transient, it means they are not part of the persistent state of the entity.
Solution:
change to:
private StaffTbl staffTbl;