hibernatexsdhyperjaxb

Hibernate index using hyperjaxb3


I am trying to add an index to a simple attribute using hyperjaxb, using the following fragment in my .xjb file:

<jxb:bindings node="./xsd:attribute[@name='serviceCode']">
    <annox:annotate target="getter">
        <annox:annotate annox:class="org.hibernate.annotations.Index" name="product_index_serviceCode" columnNames="SERVICE_CODE"/>
    </annox:annotate>
    <hj:basic>
        <orm:column length="120"/>
    </hj:basic>
</jxb:bindings>

I am getting an "Error parsing annotation.' error on the line where I have the annotation in the .xjb file. If I remove the annotation, then it works fine, but obviously, I do not get the index. I also tried moving the annotation inside the hj:basic element. In that case I do not get an error, but there is again no index being generated.


Solution

  • As @lexicore indicated, you need to put Hibernate annotations JAR as a plugin next to the JAXB Annotate plugin.