简体   繁体   English

使用hyperjaxb3的休眠索引

[英]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: 我试图在我的.xjb文件中使用以下片段,使用hyperjaxb向简单属性添加索引:

<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. 我在.xjb文件中有注释的行上出现错误。如果删除注释,则可以正常工作,但是显然,我没有索引。我还尝试将注释移到hj:basic元素内。在这种情况下,我没有收到错误,但是再次没有生成索引。

如@lexicore所示,您需要将Hibernate批注JAR作为插件放置在JAXB Annotate插件旁边。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM