@DocumentIdrequired if you are using an old school style to map objects to .hbm.xmlfiles. If you use this approach for matching and ignore the annotation of the document identifier, then at startup you will see the following exception:
org.hibernate.search.SearchException: No document id in: com.mypackage.MyEntity
However, if you use annotations and annotate the primary key with @Id, you do not need to use @DocumentId.
To be more precise, the Hibernate Search documentation indicates what @DocumentIdis optional when using JPA annotations . Therefore, you may need to use @DocumentIdit if you use Hibernate 3.x annotations. I have never tested this.
, Hibernate 4.x JPA-, , Hibernate Session, JPA EntityManager . , : @DocumentId, XML... , , JPA- .