Below Employee table(Oracle DB) has 5000 active employees. From SQL client,query takes time in ms but same query when being invoked from service class as below takes around 2 minutes.
There is no association from employee entity to another entity. So not an issue of EAGER fetching.
As suggested here tried all argument constructor but it did not help.
Employee class has around 25 attributes.
Is the time spent in converting result set into entity object?
employeeRepo.findAllByStatus("active")
Code:
class EmployeeRepository extends JpaRepository<Employee,Long>{
List<Employee> findAllByStatus(String status);
}
@Data
@Entity
@Table(name="emp_master")
@NoArgsConstrucor
class Employee{
@Id
private Long id;
@Coulmn(name="status")
private String status;
@Column(name="LEAVER_DATE")
@Convert(DateToLocalDateTimeConverter.class)
private ZonedDateTime leaverDate;
few string and Integer varibales...
}
DateToLocalDateTimeConverter converts sql timestamp to ZonedDateTime