I want to run multiple queries using @NamedQueries annotation but it is giving error that :

1. The attribute value is undefined for the annotation typed NamedQueries
2.NamedQueries can not be resolved to a type

Following is the code:

@NamedQueries({
    @NamedQuery(name="findAllBookItems",
            query = "SELECT i FROM Book i where i.isbn > 1 "),
    @NamedQuery(name="findAllCDItems",
    query = "SELECT c FROM CD c where c.numberofcds >=0 ")
})

Do i need to define this annotation somewhere ?

有帮助吗?

解决方案

Maybe an import statement?

import javax.persistence.*;

Plus of course you need the JPA implementation among your libraries.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top