Version 2

    This page is out of date.

    Several people requested support for XML mapping (rather than annotations)

    in Hibernate Search. Some people even offered to contribute it (not contributed back to far).

    Here are some guidelines to implement this feature.

     

    Infrastructure

    The code infrastructure is already available. Just like Hibernate Annotations, Hibernate Search uses Hibernate Commons Annotations to abstract the annotation reading process from the physical annotations. this is how Hibernate Annotations supports the JPA deployment descriptor.

    Hibernate Commons Annotations read the XML mapping files and generate the corresponding annotations.

    In Hibernate Annotations, all the logic is held in org.hibernate.cfg.annotations.reflection and specifically in these three classes

    • EJB3ReflectionManager : delegates the work to EJB3OverridenAnnotationReader and XMLContext
    • XMLContext : keep track of global default settings
    • EJB3OverridenAnnotationReader : parse the XML file and convert it into annotations

     

    To implement XML support for Hibernate Search, the steps are:

    • define the XML structure: it can be started from scratch or reuse the hbm.xml <meta/> element
    • implement a SearchOverridenAnnotationReader
    • implement a SearchReflectionManager

     

     

    Contribution

    Describe your progress here