Hibernate Filters - II
29 August 2008Now you know what filters are, let me take you deeper. Lets talk about how to use these.
Filters must first be defined and then attached to the appropriate mapping elements.
Use the
<filter-def name="myFilter"> <filter-param name="myFilterParam" type="string"/> </filter-def>
Folling snippet shows how to attach filter to a class:
<class name="myClass" ...> ... <filter name="myFilter" condition=":myFilterParam = MY_FILTERED_COLUMN"/> </class>
Filter can also be attached to a collection:
<set ...> <filter name="myFilter" condition=":myFilterParam = MY_FILTERED_COLUMN"/> </set>
Note: You may attach filter to class and collection at the same time.
continued …
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Hibernate Filters - II