Hibernate is 1000 times slower than sql query

后端 未结 2 472
灰色年华
灰色年华 2020-12-16 22:30

I have this setup

@Table(name =\"A\")
EntityA {
    Long ID;
    List children;
}

@Table(name =\"B\")
EntityB {
    Long ID;
    EntityA pare         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 23:13

    We noticed a similar behaviour in our system.

    And also encountered that writing the query with hardcoded parameters instead of using setParameter() would fixed the issue.

    We are using MS SQL Server and after further investigation we noticed the the root cause of our issue is a default configuration of the sql server driver that transmits the query parameters as unicode. This lead to our indices being ignored since they were based on the ascii values on the queried columns.

    The solution was to setup this property in the jdbc url : sendStringParametersAsUnicode=false

    More details can be found here. https://stackoverflow.com/a/32867579

提交回复
热议问题