Hello,
I'm having an issue with lazy loading of collections. We have created some collection implementations for use in our hibernate objects mainly to enforce type safety in collections, and to maintain bi-directional references. Let me give an example:
Contained in class blah.Parent:
Code:
/**
* @hibernate.set table="CHILDREN" lazy="true" cascade="all" inverse="true"
* @hibernate.collection-key column="COLLECTION_ID"
* @hibernate.collection-one-to-many class="blah.Child"
* @return Set
*/
public Set getChildren() {
return children;
}
protected void setChildren(Set children) {
this.children= new CfSet(Child.class, children, new ChildCallback());
}
This obviously has the unwanted effect of overriding lazy initialization:
Code:
select p from blah.Parent p
results in not only selects against the PARENTS table, but the CHILDREN table as well. If I change the setChildren method to
Code:
protected void setChildren(Set children) {
this.children= children;
}
selects are only executed against the PARENTS table.
Is there any work around that would allow us to use our collection implementations while still allowing lazy loading to work as expected?
-Thanks