Hello,
We've got a weird problem when fetching collections:
class A {
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="a")
private Set<B> bs;
}
class B {
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="a_id", nullable=false)
private A a;
}
Code to fetch instances of A (with collections of B)
Query query = em.createQuery ("select a from A a");
for (Object obj : query.getResultList ()) {
cache.addA ((A)obj);
}
When needed we access the A.bs to get one out of the collection.
When done standalone everything works fine, but when running the same within a
stateful
SessionBean on an ApplicationServer (Geronimo) the collection is empty.
Even more weird: I can work-around the problem when iterating the collection
right after it was
fetched.
Any ideas, what I'm doing wrong (it doesn't depend on the FetchType)?
kind regards,
Michael