15.6. Annotating Objects and Storing Indexes

15.6.1. Annotating Objects for Infinispan Query

Once indexing has been enabled, custom objects being stored in JBoss Data Grid need to be assigned appropriate Infinispan Query annotations.
As a basic requirement, all objects required to be indexed must be annotated with
  • @Entity
  • @Indexed
  • @ProvidedId
In addition, all fields within the object that will be searched need to be annotated with @Field.
For example:
@Entity @ProvidedId @Indexed
public class Person
	implements Serializable {
		@Field(store = Store.YES)
		private String name;
		@Field(store = Store.YES)
		private String description;
		@Field(store = Store.YES)
		private int age;
...
}
For more useful annotations and options, refer to the JBoss Web Framework Kit Hibernate Search guide.

Important

The Query Module is currently only available as a Technical Preview for JBoss Data Grid 6.1.