通常在Java
8中,@NamedQuery
是可重复的。
然而,当我编译时,我有错误:
javax.persistence.NamedQuery is not a repeatable annotation type
这是我的源代码:
@NamedQuery(name = "listDocumentsByStatus", query = "FROM Document d WHERE d.status = :STATUS ")
@NamedQuery(name = "listDocumentsByNameAndType", query = "FROM Document d WHERE d.type = :TYPE AND UPPER(d.name) LIKE :NAME ")
public abstract class Document implements Serializable {
...
}
我是否误解了某些人的行为?
答案 0 :(得分:0)
请试试这个
@Entity
@NamedQueries(@NamedQuery(name = "findAllExtensionsSorted", query = "select e from Abc e order by e.c")
@NamedQuery(name = "findByType", query = "select e from Abc e where e.t = :type"))
public class Abc...