我的问题非常简单明了。我需要在生成的实体类中添加@NamedQueries批注。使用Hyperjaxb生成JPA层。我不知道如何使用 元素添加此行
...
@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>
答案 0 :(得分: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>