Spring JPA查询-简单的选择查询需要太多时间

在Employee表(Oracle DB)下面有5000个活动员工。 从SQL客户端,查询花费时间(以毫秒为单位),但从中调用时查询相同 如下所示的服务课程大约需要2分钟。

从雇员实体到另一个实体之间没有关联。 因此,这不是EAGER提取的问题。

根据建议here尝试了所有参数构造函数,但没有帮助。

Employee类具有大约25个属性。

将结果集转换为实体对象所花费的时间吗?

  employeeRepo.findAllByStatus("active")

代码:

 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将sql时间戳转换为ZonedDateTime

eileencxy227 回答:Spring JPA查询-简单的选择查询需要太多时间

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3122561.html

大家都在问