Tuesday, 8 September 2009

Filtering details in Master-Detail edit

I came across an article about another FetchType that may be useful in reducing the number of Detail rows loaded when paging and/or filtering the Detail List (see previous posts about Master-Detail editing and Filtering).

Hibernate has the Lazy fetch strategy, which is fairly standard. Under this strategy, Hibernate will load the Detail rows only when we first access the list. The problem is it will load all rows from the database. If we are detail with thousands of Detail rows, this could be a problem.

Hibernate also has an "Extra Lazy" fetching strategy. This will only load individual rows when they are accessed (as opposed to Lazy, which loads the entire collection). This seems to be more what we are looking for if we need to filter and paginate a List of Detail rows.

It's done at the mapping level, so it's going to require some investigation to see how this affects regular processes.

No comments:

Post a Comment