so, i am really clutching at straws for ideas here. (also note: this is an intermittent problem)
i have a 'parent' object with a collection of 'child' objects:
<parent stuff>
...
<set name="children" inverse="true" order-by="child_id">
<cache usage="read-write"/>
<key column="parent_id"/>
<one-to-many class="ChildClass"/>
</set>
...
</parent>
<child stuff>
...
<many-to-one name="parent"
column="parent_id"
insert="true"
update="true"
not-null="true"
class="ParentClass"
index="idx_child_parent"/>
...
</child>
if i run a query that is like: "select children from ChildClass child " + "where child.parent = :parent"; it finds all the children. perfect.
however, if i search for the parent object (and find it), hibernate goes through and creates my ParentClass, but only populates ONE (the first) child of children. i actually debugged into the hibernate code and found that infact the call to setChildren() on ParentClass was only being sent a 1 element collection - when i know there are more from the first query.
so, i am using EHCache, and clearing it does no good: calling CacheManager.getInstance().clearAll();
restarting my application DOES work. only for it to break shortly afterwards on a seemingly random instance of a parent.
there isnt anything (that i know of) that is happening to directly cause this. does anyone know of a hibernate bug that would cause this, or an EHCache bug. am i calling clear properly on my cache?
any pointers would be good.
i am using hibernate 3.2.6, and the same problem is happening on mysql and postgres.
edit: i should also add that this collection with only 1 element is in a sort of 'never existed' state. ie. there was never a transaction that resulted in only 1 child element