Are there any guidelines for setting batch-size on a lazy loaded collection, particularly in the case of a one-to-many association?
Take a Person object with a one-to-many assocation to Address objects.
If the Address end of the association was particularly hard or expensive to load, I can understand setting batch-size to a relatively small number. But in this case (and likely most cases), I am selecting, say, less than ten fields (non-LOB) to get each Address object. Why would I even want to set a batch-size? My immediate thought is batch-size="1000" -- or better, batch-size="all of 'em" (obviously not a valid syntax ;) ).
So, I feel like I must be missing something here. If hibernate is only going to batch-load the uninitialized Address objects in the session, and that only requires a single statement, why wouldn't I want rows for all the uninitialized Address objects in the session by default?
Sorry if it's a stupid question, but I did try to search for an answer to it.
|