javax.persistence.NamedQuery不是可重复的注释类型

时间:2016-04-27 15:05:06

标签: annotations java-8

通常在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 {
...
}

我是否误解了某些人的行为?

1 个答案:

答案 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...