使用 Jaxb 或 HyperJaxb 生成 @Indexed 注释 [英] Generate @Indexed annotation using Jaxb or HyperJaxb

查看:30
本文介绍了使用 Jaxb 或 HyperJaxb 生成 @Indexed 注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的作业中实现基于 lucene 的休眠搜索.为了生成域对象,我使用了 HyperJaxb3.

I want to implement lucene based hibernate search in my assignment. For generating domain objects I am using HyperJaxb3.

我希望在使用 HyperJaxb 创建域对象期间添加 @Indexed 注释.

I want @Indexed annotation to be added during domain object creation using HyperJaxb.

我尝试使用谷歌搜索,但无法找到解决方案.

I tried googling for this, but unable to find solutions.

这方面的任何指示都会有很大帮助.

Any pointer in this regard will be of great help.

推荐答案

注解插件 是正确答案.请参阅此示例.

Annotate plugin is the right answer. See this example.

这是它在架构中的样子:

This is how it looks in schema:

  ....
  xmlns:hs="http://annox.dev.java.net/org.hibernate.search.annotations"
  ...

  <xsd:complexType name="USAddress">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string">
        <xsd:annotation>
          <xsd:appinfo>
            <annox:annotate>
              <hs:FieldBridge impl="org.jvnet.hyperjaxb3.ejb.tests.annox.Items">
                <params>
                  <hs:Parameter name="foo" value="bar"/>
                </params>
              </hs:FieldBridge>
            </annox:annotate>
          </xsd:appinfo>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="street" type="xsd:string"/>
      <xsd:element name="city" type="xsd:string"/>
      <xsd:element name="state" type="xsd:string"/>
      <xsd:element name="zip" type="xsd:decimal"/>
    </xsd:sequence>
    <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
  </xsd:complexType>

您还可以使用额外的绑定文件(请参阅示例).

You can also use extra binding files (see the example).

这篇关于使用 Jaxb 或 HyperJaxb 生成 @Indexed 注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆