0% found this document useful (0 votes)
18 views2 pages

Native Query

Uploaded by

Mohamamd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Native Query

Uploaded by

Mohamamd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

@Entity(name="EmployeeEntity")

@Table (name="employee")

@NamedNativeQueries({

@NamedNativeQuery(

name = "getAllEmployees",

query = "SELECT id, firstName, lastName, email, [Link], [Link] " +

"FROM employee, department",

resultClass=[Link]

),

@NamedNativeQuery(

name = "getAllEmployeesByDeptId",

query = "SELECT id, firstName, lastName, email, [Link], [Link] " +

"FROM employee, department " +

"WHERE [Link] = ?",

resultClass=[Link]

})

public class EmployeeEntity implements Serializable

//more code

@Override

public List<EmployeeEntity> getAllEmployees() {

List<EmployeeEntity> employees = [Link]("getAllEmployees",


[Link])
.getResultList();

return employees;

@Override

public List<EmployeeEntity> getAllEmployeesByDeptId(Integer id) {

List<EmployeeEntity> employees = [Link]("getAllEmployeesByDeptId",


[Link])

.setParameter(1, id)

.getResultList();

return employees;

You might also like