Are there cut and paste errors in that post? Or are both sets identical except for the key columns? Same table, same class (and further, same class as the owning class), etc.?
If that's all correct, then your only solution (that I can think of) is to finish loading one collection before loading the next. You can either initialize the collection completely, or evict it so that hibernate knows that you don't intend to fetch any more items via it.
It is possible that mapping Employee, Supervisor and DirectReport as three separate classes (that reference the same tables) may resolve this, but I've never dealt with a schema like this before. I'd have gone with three separate tables, even if they do have identical columns: in addition to being more "human readable", it would cut down index sizes, and make for better index clustering for faster collection loading.
_________________ Code tags are your friend. Know them and use them.
|