I have switched over our application from hbm.xml files to annotations and find that a collection is being retreived as NULL. My understanding is that this is AlWAYS a bug, and that the collection should come back as empty in some cases but never null.
Is that correct?
The collection is nested inside a couple containers so there are two levels of eager fetching going on, if that matters.
Here are mapping files and more info:
Hibernate version:
3.2.5 core + 3.2.5 annotations
Mapping documents:
Code:
class Victim
@OneToMany(fetch=FetchType.LAZY, targetEntity=com.app.VictimInfo.class, mappedBy = "victim")
public Set getVictimInfos() {
return this.victimInfos;
}
class VictimInfo...
@ManyToOne
@JoinColumn(name="Victim_GUID")
public com.app.Victim getVictim() {
return this.victim;
}
specifically, I get a null pointer exception when trying to process victim.getInfos() in some way. Our code assumes the collection may be empty but will never be null.