Slow performance on Hibernate + Java but fast when I use TOAD with the same native Oracle query

前端 未结 3 1351
难免孤独
难免孤独 2021-01-01 21:07

I\'ve detected a performance problem with hibernate and native queries on Oracle. When I execute a complex SQL query with several parameters on TOAD I get the result in mili

3条回答
  •  庸人自扰
    2021-01-01 21:41

    My answer to you is:

    Remove all bind parameters and use StatelessSession instead of Session

    Use SQLQuery instead of query with full SQL including parameter values

    StatelessSession session = sessionFactory.openStatelessSession();
    

    I had similar problem and till I get better solution,this is what I managed to make it work. See Hibernate parameterized sql query slow and active oracle sessions

提交回复
热议问题