Can Hibernate be configured such that is understands that all children in a one to many relationship are in the cache?
This would allow it to query the cache to determine the children when navigating from parent to children, instead of querying the database.
e.g.
Code:
class Parent {
Set children; // one-to-many
}
class Child {
Parent parent; // many-to-one
}
// Load
Collection children = session.createCriteria(Child.class).list();
Collection parents = session.createCriteria(Parent.class).list();
...
// Ideally, calling the line below would not cause Hibernate to determine the children from the database, but from the session cache instead.
parent.getChildren().iterator().next() ...
Note: I understand I can configure outer-join and batch-size parameters to improve Hibernate's default performance, but both have significant limitations in functionality and performance.
If Hibernate cannot query the cache, does anyone have an efficient work-around for the scenario of loading any entire object graph?
Hibernate version:
2.x or 3.x