Spring boot with JPA(Hibernate) after deployment first save/saveAll (write) to Database is very slow almost 20 seconds. but fetch/get are faster
Spring boot with JPA(Hibernate) after deployment first save/saveAll (write) to Database is very slow almost 20 seconds. but fetch/get are faster . (Running app in docker with 1CPU and 2GB RAM to have same as AWS)
Config are below
“spring.datasource.driver-class-name”: “com.mysql.cj.jdbc.Driver”,
“spring.datasource.password”: “pwd”,
“spring.datasource.url”: “jdbc:mysql://localhost5:3306/db?allowPublicKeyRetrieval=TRUE”,
“spring.datasource.username”: “usr”,
“spring.jpa.properties.hibernate.default_lazy_behavior”: false,
“spring.jpa.properties.hibernate.dialect”: “org.hibernate.dialect.MySQL8Dialect”,
“spring.jpa.properties.hibernate.hbm2ddl.auto”: “none”,
“spring.jpa.show-sql”: true,
“spring.jpa.properties.hibernate.format_sql”: true,
“spring.jpa.properties.hibernate.jdbc.batch_size”: 20,
“spring.jpa.properties.hibernate.order_inserts”: true,
“spring.jpa.properties.hibernate.order_updates”: true,
“spring.datasource.hikari.minimum-idle”: 10,
“spring.datasource.hikari.maximum-pool-size”: 30,
“spring.datasource.hikari.idle-timeout”: 30000,
“spring.datasource.hikari.connection-timeout”: 30000,
“spring.datasource.hikari.max-lifetime”: 1800000,
“spring.datasource.hikari.pool-name”: “HikariCP”,
“spring.main.lazy-initialization”: false,
“spring.datasource.initialization-mode”:”always”,
“spring.datasource.hikari.initialization-fail-timeout”:0,
“spring.jpa.hibernate.ddl-auto”:”validate”
one-to-many: JPA generates wrong FK while using ddl-auto=create-drop
It seems that I made a mistake somewhere but I can not see where.
JPA insists to generate a unique constraint on a FK of one-to-many
relationship on the child side. This constraint prevents me to insert more then one record in the child table.
JPA generates wrong FK
It seems that I made a mistake somewhere but I can not see where.
JPA insists to generate a unique constraint on a FK of one-to-many
relationship on the child side. This constraint prevents me to insert more then one record in the child table.
Is @PostUpdate supposed to be called when you’re modifying data in a one-to-many collection?
I’m using Hibernate for my JPA. I marked a method as @PostUpdate
but it does not appear to be called if I save the object but only make the changes to an entity in a sub collection
Entire entity returned as null after query
I have following entity :
JPA Left Join using CriteriaQuery With Where Clause on Joined Table OneToMany
I am trying to implement a similar to the below with an Criteria Builder. Although I am able to get the Left Join correctly over an entire table, I am unsure how to do while adding a where clause. Any suggestions on exactly how to go about this?
Spring + Hibernate batch inserts doesnt work
I’m setting properties