concept Hibernate Annotations in category hibernate
appears as: Hibernate Annotations

This is an excerpt from Manning's book Hibernate Search in Action.
Hibernate Core APIs and Hibernate Annotations
If your domain model uses Hibernate Annotations or Java Persistence annotations, you’re using Hibernate Annotations. If your application uses the Hibernate EntityManager API (the Java Persistence API really), you’re also using Hibernate Annotations under the cover. If you’re still unsure, check whether you create a Configuration object or an AnnotationConfiguration object. In the former case, you’re using Hibernate Core. In the latter case, you’re using Hibernate Annotations. Why is that? Hibernate Annotations detects Hibernate Search and is able to autowire Hibernate event listeners for you. Unfortunately this is not (yet) the case for Hibernate Core. If you’re using only Hibernate Core, you need to add the event listener configuration, as shown in listing 2.4.
Listing 2.4. Enable event listeners if you don’t use Hibernate Annotations
<hibernate-configuration> <session-factory> ... <event type="post-update"> <listener class="org.hibernate.search.event.FullTextIndexEventListener"/> </event> <event type="post-insert"> <listener class="org.hibernate.search.event.FullTextIndexEventListener"/> </event> <event type="post-delete"> <listener class="org.hibernate.search.event.FullTextIndexEventListener"/> </event> <event type="post-collection-recreate"> <listener class="org.hibernate.search.event.FullTextIndexEventListener"/> </event> <event type="post-collection-remove"> <listener class="org.hibernate.search.event.FullTextIndexEventListener"/> </event> <event type="post-collection-update"> <listener class="org.hibernate.search.event.FullTextIndexEventListener"/> </event> </session-factory> </hibernate-configuration>
The previous example shows the use of Hibernate Search in conjunction with Hibernate Annotations, but the same example would work perfectly with hbm.xml files as well. This is particularly useful if you try to use Hibernate Search on an existing Hibernate Core–based application where the mapping is defined in XML. Have a look at listing 2.7.