Tried to configure hibernates default_batch_fetch_size
through the spring application.yml
.
AFAIK the setting has the same effect as putting @BatchSize(size = xxx)
annotations on all your entity-relationships.
I enabled spring.jpa.properties.hibernate.generate_statistics: true
and logging accordingly and tried setting
spring:
jpa:
properties:
hibernate:
jdbc:
batch_size: 100
default_batch_fetch_size: 30
I also tried
spring:
jpa:
hibernate:
ddl-auto: none
default_batch_fetch_size: 30
but that configuration property doesn't seem to exist at all.
Resulting Logs show that hibernate won't fetch collections batched, but N+1 (FetchMode is not specified - thus the default @Fetch(FetchMode.SELECT)
is used - and I don't want to change that).