Hi,
Hibernate gives the feature of selecting (filtering) the no of feilds/or columns needed with Projections Concept.
My Doubt here is how can utilize the same kind of stuff to improve the Performance in JPA.
please suggest me if there is any approach.
Code:
import java.util.Date;
public class Employee {
private int empId;
private String empName;
private Date dob;
private long salary;
public int getEmpId() {
return empId;
}
public void setEmpId(int empId) {
this.empId = empId;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
public Date getDob() {
return dob;
}
public void setDob(Date dob) {
this.dob = dob;
}
public long getSalary() {
return salary;
}
public void setSalary(long salary) {
this.salary = salary;
}
}
let us consider the above is my entity with jpa annotations.
if i run the Named Query like 'From Employee' this will fetch 4 columns like 'select * from employee'
But i need 'select empId,empName from Employee' - this will return the List<Object[]> but not List<Employee>
I am stuck with Performance Problem where i need to join more than 8 tables, some are oneToOne association so i m left joining , some tables has more than 100 columns.
Can you please some one suggest the best way as i m using only jpa with hibernate and not using hibernate session directly.