I believe that class filters apply to get/load, HQL "from RelevantClass" and Criteria on that class: that is, cases where the filtered class is the "top level" search item. If you want to filter the association between a different class and a collection of the relevant class, you need to set up a different filter specifically for the collection.
I don't know if it's intended to be that way, but I haven't read anything that says that it isn't. I have written code that depends on it working like this, so I'm hoping that it is intended to work like this :) I'm guessing that the rationale is that in the case that you're talking about, you'll end up with a "partial" object (each instance of A you load after turning on the filter isn't a complete A, it's missing some items that really should be in the collection), so you have to really, really want that partial object before hibernate will create it for you. It's too likely that, if someone turns on the class filter for B, they won't realize that other classes are going to be affected, and they'll complain when it happens. So the hibernate developers have made it explicit.
_________________ Code tags are your friend. Know them and use them.
|