Hibernate Filters - II

29 August 2008

Now 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 element within a element:

<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 …

del.icio.us:Hibernate Filters - II  digg:Hibernate Filters - II  spurl:Hibernate Filters - II  wists:Hibernate Filters - II  simpy:Hibernate Filters - II  newsvine:Hibernate Filters - II  blinklist:Hibernate Filters - II  furl:Hibernate Filters - II  reddit:Hibernate Filters - II  fark:Hibernate Filters - II  blogmarks:Hibernate Filters - II  Y!:Hibernate Filters - II  smarking:Hibernate Filters - II  magnolia:Hibernate Filters - II  segnalo:Hibernate Filters - II  gifttagging:Hibernate Filters - II

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

Leave a Reply