Expr (attribute of suggest)

From JRapid

Jump to: navigation, search

expr is an attribute of suggest.



When a suggest element is defined for a property the HQL expression used to retrieve the suggested values is specified in the expr attribute.

The expression in expr receives one and only one parameter. This parameter holds the value currently entered for the property using the suggest and must be used in the HQL expression.


   expr = HQL


This HQL expression suggests all existing city values that contain the current entered value as part of their name. Note the usage of the value received as a parameter by including the "?" in the HQL expression.

 <property name="city" label="City" >
       <suggest expr="SELECT a.city FROM Address as a WHERE a.city LIKE concat('%', ?, '%')"/>

See also

Personal tools