for (ReviewQuestion question : questions) {
List<ReviewQuestionOption> options = question.getOptions();
if (options.isEmpty()) {
continue;
}
Fraction basic = new Fraction(100).divide(options.size());
for (int i = 0; i < options.size(); i++) {
ReviewQuestionOption reviewQuestionOption = options.get(i);
double weight = basic.multiply(i + 1).doubleValue();
reviewQuestionOption.setPointWeight(BigDecimal.valueOf(Math.floor(weight * 10) / 10 + 1));
}
reviewQuestionOptionRepository.saveAll(options);
}
spring.jpa.properties.hibernate.jdbc.batch_size=30
spring.jpa.properties.hibernate.batch_versioned_data=true
spring.datasource.url=jdbc:mysql://localhost:3306/mydb?rewriteBatchedStatements=true
DB is MySQL
ReviewQuestionOption Id generate is @GeneratedValue(strategy = GenerationType.IDENTITY)
I want to find the reason why it’s not possible in the hibernate docs