I am trying to execute a namedquery
@NamedQuery(name=\"getEmployeeDetails\",query=\"select e.username,e.email,e.image,e.firstname,e.lastname from Employee e
Below is the sample query which fetches only the required fields, but have to make such constructor for it.
Query : SELECT NEW package_name.Employee(e.username,e.email,e.image,e.firstname,e.lastname) FROM Employee e where e.empid=?1;
It will return Employee entity with selected fields & remaining will have default values.