如何使用 hyperjaxb 添加 NamedQueries 注解
How to add NamedQueries annotation with hyperjaxb
我的问题很简单明了。我需要向生成的实体 类 添加 @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>
我想通了
<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>
我的问题很简单明了。我需要向生成的实体 类 添加 @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>
我想通了
<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>