JPA NamedNativeQuery and NamedNativeQueries annotations

The @NamedNativeQuery and @NamedNativeQueries annotations are used to define one or more SQL queries. These queries will be associated with that particular entity.

@NamedNativeQuery Example:

@Entity
@NamedNativeQuery (name="Student.selectAllStudents", query="SELECT st FROM STUDENTS st") 
public class Students {
  ...
}

@NamedQueries Example:

@Entity
@NamedQueries({
   @NamedQuery(name="Student.selectAllStudents", query="SELECT st FROM STUDENTS st")
})
public class Students {
  ...
}
Please Share