사용자 도구

사이트 도구


java:hibernate:performance

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
마지막 판 양쪽 다음 판
java:hibernate:performance [2022/12/07 14:07]
kwon37xi [hibernate.query.in_clause_parameter_padding=true]
java:hibernate:performance [2024/01/10 16:18]
kwon37xi [autoCommit 을 꺼서 성능 향상시키기]
줄 22: 줄 22:
   * 따라서 ''@BatchSize''나 ''default_batch_size'' 를 지정하고, join fetch 보다는 ''Hibernate.initialize(lazy로딩객체)'' 형태를 사용하는게 더 나을 수 있다. 이 경우에는 1+1 번 조회가 나가는 편이다(batch size에 따라 달라짐. batch size 단위로 조회 반복).   * 따라서 ''@BatchSize''나 ''default_batch_size'' 를 지정하고, join fetch 보다는 ''Hibernate.initialize(lazy로딩객체)'' 형태를 사용하는게 더 나을 수 있다. 이 경우에는 1+1 번 조회가 나가는 편이다(batch size에 따라 달라짐. batch size 단위로 조회 반복).
   * see [[java:hibernate:gotchas|Hibernate/JPA Gotcha]]   * see [[java:hibernate:gotchas|Hibernate/JPA Gotcha]]
 +  * [[java:hibernate:configuration|Hibernate Configurations]] - ''hibernate.query.fail_on_pagination_over_collection_fetch=true'' 옵션을 켜서 미리 에러를 내고 확인해서 고쳐두는게 좋다.
 ===== @org.hibernate.annotations.BatchSize ===== ===== @org.hibernate.annotations.BatchSize =====
 ''batch-size'' 설정은 **OneToMany** 등의 관계에서 Many쪽 Lazy Proxy 객체를 로딩할때, 한번에 로딩할 갯수를 지정한다. ''batch-size'' 설정은 **OneToMany** 등의 관계에서 Many쪽 Lazy Proxy 객체를 로딩할때, 한번에 로딩할 갯수를 지정한다.
줄 79: 줄 80:
   * [[springframework:springboot:2|SpringBoot 2]] 부터는 커넥션 풀의 ''auto-commit'' 설정값에 따라 자동으로 ''hibernate.connection.provider_disables_autocommit: true'' 설정을 해준다.    * [[springframework:springboot:2|SpringBoot 2]] 부터는 커넥션 풀의 ''auto-commit'' 설정값에 따라 자동으로 ''hibernate.connection.provider_disables_autocommit: true'' 설정을 해준다. 
     * [[https://github.com/spring-projects/spring-boot/issues/9261|Consider disabling auto-commit when wiring connection pool configs and setting hibernate.connection.provider_disables_autocommit for resource-local transactions · Issue #9261 · spring-projects/spring-boot]]     * [[https://github.com/spring-projects/spring-boot/issues/9261|Consider disabling auto-commit when wiring connection pool configs and setting hibernate.connection.provider_disables_autocommit for resource-local transactions · Issue #9261 · spring-projects/spring-boot]]
 +    * https://github.com/spring-projects/spring-boot/pull/9737
     * ''HibernateJpaConfiguration.java'' <code java>     * ''HibernateJpaConfiguration.java'' <code java>
 if (!vendorProperties.containsKey(PROVIDER_DISABLES_AUTOCOMMIT)) {  if (!vendorProperties.containsKey(PROVIDER_DISABLES_AUTOCOMMIT)) { 
java/hibernate/performance.txt · 마지막으로 수정됨: 2024/03/04 12:47 저자 kwon37xi