diff --git a/documentation/src/main/docbook/manual/en-US/content/filters.xml b/documentation/src/main/docbook/manual/en-US/content/filters.xml index 851f13d6e5..e76151520c 100755 --- a/documentation/src/main/docbook/manual/en-US/content/filters.xml +++ b/documentation/src/main/docbook/manual/en-US/content/filters.xml @@ -63,15 +63,38 @@ public class Forest { ... } Using <classname>@FilterJoinTable</classname> for filterting on the association table - @OneToMany - @JoinTable - //filter on the target entity table - @Filter(name="betweenLength", condition=":minLength <= length and :maxLength >= length") - //filter on the association table - @FilterJoinTable(name="security", condition=":userlevel >= requredLevel") - public Set<Forest> getForests() { ... } + @OneToMany +@JoinTable +//filter on the target entity table +@Filter(name="betweenLength", condition=":minLength <= length and :maxLength >= length") +//filter on the association table +@FilterJoinTable(name="security", condition=":userlevel >= requredLevel") +public Set<Forest> getForests() { ... } + By default, Hibernate attempts to automatically determine all points within the + @Filter SQL condition fragment that an alias should be injected. To control the alias injection, + set deduceAliasInjectionPoints to false within the + @Filter. Injection points are then marked using @SqlFragmentAlias annotations or + within the SQL's condition fragment using {alias}. + + In addition to allowing explicit alias control, deduceAliasInjectionPoints + provides an out when Hibernate assumes an ANSI SQL reserved keyword is a column and incorrectly aliases it. + + + @Filter annotation, disabling deduceAliasInjectionPoints + + @Entity +@Table(name="T_TREE") +@Filters({ + @Filter(name="isTall", condition="{alias}.LENGTH >= 100", deduceAliasInjectionPoints = false), + @Filter(name="isOak", condition="{t}.WOODTYPE like 'oak'", deduceAliasInjectionPoints = false, + aliases={@SqlFragmentAlias(alias="t", table="T_TREE")}) +}) +public class Tree { ... } + + + Using Hibernate mapping files for defining filters the situtation is very similar. The filters must first be defined and then attached to the appropriate mapping elements. To define a filter, use the