Hey folks, I've got a bit of a performance problem, and I'm wondering if I can somehow configuring hibernate's caching or fetching to work with me better. Our database has a table with a column that holds a huge xml file that contains the configuration for the entire system (not my design). Many objects in the database have collections (Sets) mapped indicating the configuration record they are applied to. We only have a few system configuration rows, but thousands of other objects referencing them. At the moment, I'm trying to go through those other objects and update their system configuration sets. Each time I want to add an element to the set, hibernate has to materialize the other items in the set to compare with. So I end up with thousands of selects.
I've tried fetching all of those collections in an initial query, to get them all in cache. However, hibernate writes this query with a join through the system configuration table, and for every other object brings back the column with the huge xml configuration. So that query is dog slow. Really, hibernate only needs to grab the dozen or so (huge) configuration records, and then for each other (tiny) object figure out which one of the ones already in memory it points to by looking at the join table. But I can't get hibernate to act in this manner.
Any ideas?
Thanks so much!
|