Can Hibernate be used in performance sensitive applications?

后端 未结 4 689
滥情空心
滥情空心 2020-12-23 18:00

I\'m seeing performance problems with retrieving multiple instances of objects that have many relationships with other objects. I\'m using Spring and Hibernate\'s JPA implem

4条回答
  •  温柔的废话
    2020-12-23 18:10

    See my answer to your other question, if you read the whole of the FAQ you linked to:

    Follow the best practices guide! Ensure that all and mappings specify lazy="true" in Hibernate2 (this is the new default in Hibernate3). Use HQL LEFT JOIN FETCH to specify which associations you need to be retrieved in the initial SQL SELECT.

    A second way to avoid the n+1 selects problem is to use fetch="subselect" in Hibernate3.

    If you are still unsure, refer to the Hibernate documentation and Hibernate in Action.

    See the tips on improving performance. If you are not careful with joins, you will end up with Cartesian Product problems.

提交回复
热议问题