What casuses Spring Boot Fail-safe cleanup (collections) to occur

前端 未结 5 2372
梦谈多话
梦谈多话 2021-02-20 14:35

I have a Java Spring Boot application with the following entities related to the below exception

SProduct

@Entity
@Table(
        name =         


        
5条回答
  •  野性不改
    2021-02-20 15:00

    It seems like you are loading huge amount of data in your application.

    The method

    FBT findByMainProductAndCollection(SProduct mainProduct,Date collection);
    

    will load all the matching data. But you only need count try the query that exactly return count of data instead of all the data.

    One way to do is using the query you mentioned and other way is

    Long countByMainProductAndCollection(SProduct mainProduct, Date collection);
    

    Or

    Boolean existsByMainProductAndCollection(SProduct mainProduct, Date collection)
    

提交回复
热议问题