0

我的问题非常简单明了。我需要在生成的实体类中添加一个 @NamedQueries 注释。JPA 层是使用 Hyperjaxb 生成的。我不知道如何使用添加此行的元素

...
@NamedQueries(value = {
    @NamedQuery(name ="SampleType.sampleQuery", query="select r from SampleType r where r.index=:index"),
})
public class SampleType{
....
}

如何将该特定注释添加到生成的类型?

<bindings node="xsd:complexType[@name='SampleType']">
.... // What do I put here???
</bindings>
4

1 回答 1

0

我想通了

<bindings node="xsd:complexType[@name='SampleType']">
<annox:annotate>
    <annox:annotate
        annox:class="org.hibernate.annotations.NamedQueries">
        <annox:annotate
            annox:class="org.hibernate.annotations.NamedQuery"
            name="SampleType.sampleQuery" query="select r from SampleType r where r.index=:index">
        </annox:annotate>
    </annox:annotate>
</annox:annotate> 
....
....
</bindings>
于 2016-02-24T19:36:45.017 回答