Tutorialspoint examples

Learn java tutorial with examples for beginners online

JPA NamedQuery and NamedQueries annotations


The @NamedQuery and @NamedQueries annotations are used to define one or more JPQL queries. These queries will be associated with that particular entity.

@NamedQuery Example:

@Entity
@NamedQuery(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 {
  ...
}

Posted in JPA   
Download tutorialspointexamples Android App
Copyright © 2018 Tutorialspoint examples DMCA.com Protection Status