我想在我的任务中实现基于lucene的hibernate搜索。为了生成域对象,我使用了HyperJaxb3。
我希望在使用HyperJaxb创建域对象的过程中添加@Indexed注释。
我试着用谷歌搜索这个问题,但找不到解决方案。
在这方面的任何指针都将是非常有帮助的。
发布于 2011-09-08 16:10:26
Annotate plugin是正确的答案。参见this example。
这是它在模式中的外观:
....
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>您还可以使用额外的绑定文件(请参阅example)。
https://stackoverflow.com/questions/7343478
复制相似问题