Package org.openxava.annotations
Annotation Type SearchKey
-
@Retention(RUNTIME) @Target({FIELD,METHOD}) public @interface SearchKey
A search key property or reference is used by the user to search.Applies to properties and references.
If the @
Id
property is @Hidden
you can useSearchKey
to indicate what property or reference will be used for searching.
By default, OpenXava allows to the user to search objects (in references for example) by the @Id property, if the @Id property is hidden then the first property of the view is used. In some case you want to choose what properties will be use for searching. @SearchKey is for that. Example:@Id @GeneratedValue(generator="system-uuid") @Hidden @GenericGenerator(name="system-uuid", strategy = "uuid") private String oid; @SearchKey @Column(length=4) @DefaultValueCalculator(CurrentYearCalculator.class) private int year; @SearchKey @Column(length=6) private int number;
In this caseoid
is a hidden id, and the user will be useyear
andnumber
for searching the objects in references. The propertiesyear
andnumber
are search keys.- Author:
- Javier Paniza