CodesJava

Easy learning with example program codes

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   


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap