0

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.

Buğra Gedik
  • 714
  • 8
  • 16
  • 1
    Did you add Hibernate annotations JAR as a plugin next to the JAXB Annotate plugin? The annotate plugin needs annotation classes to parse XML. Alternatively you can just define you annotation in Java syntax (with fully qualified classes). – lexicore Jul 13 '16 at 13:56
  • @lexicore Thanks, I figured that out sometime back, but forgot to update the StackOverflow entry. – Buğra Gedik Aug 08 '16 at 17:03

1 Answers1

0

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

Buğra Gedik
  • 714
  • 8
  • 16