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;
...
}
Copy to Clipboard Toggle word wrap
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.
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat
Back to top