Tutorialspoint examples

Learn java tutorial with examples for beginners online

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 {
  ...
}

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