Generate @Indexed annotation using Jaxb or HyperJaxb
Asked Answered
U

1

2

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

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.

Unseam answered 8/9, 2011 at 5:28 Comment(2)
I tried using the annotate plugin to adds Hibernate Search annotations like @Indexed, but could not achieve.Unseam
Please post the error message, logs - anything that illustrates the problem. It does work.Ingram
I
2

[Annotate plugin][1] is the right answer. See [this example][2].

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][2]).

[1]: BAD LINK [2]: https://svn.java.net/svn/hj3~svn/trunk/ejb/tests/annox/

Ingram answered 8/9, 2011 at 8:10 Comment(2)
Please have a look at my related question at #9800337. Would be great if you could assist.Dreamy
The first link you posted ends up redirecting to a VERY dubious site...Appendicular

© 2022 - 2024 — McMap. All rights reserved.