-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve strategy for persisting referenced entities [DATAJDBC-210] #437
Comments
Anton Reshetnikov commented +1 for
I was going to create separate issue for batched jdbc operations in Spring DATA JDBC, but found this issue |
Jens Schauder commented Anton Reshetnikov batch inserts will have to wait until we have proper support for Id generation strategies, because the current one (via SERIAL/AUTOINCREMENT in the database) does not work with batches. See spring-projects/spring-framework#6530 |
+1 for 1 st and 3.1
I think that the 1 st option must be default behavior or may be switched on by some annotation on Aggregate Root.
|
Hi @schauder, I was checking the code related to this issue. I was thinking of the below ideas. Idea#1. Most of the database (supporting Spring boot JDBC) supports merge statements. For MySQL or MariaDB, we can go for ON DUPLICATE KEY UPDATE. I am not sure if it is a good idea to write a database-specific query. Idea#2. Could we re-iterate the same root aggregate solution for all leaf entities? For example: Aggregate Root A references Entities B and Entity B references Entities C. JdbcAggregateTemplate
WritingContext.java
This is just my thinking as a newbie, you know better since you have written this code. 😃 |
If only there were a standard that all the RDBMS adhere to... Seriously: That's what |
This is an Epic gathering various approaches to improve the writing behaviour of Spring Data JDBC.
If we have an Aggregate Root
A
referencing entitiesB
on update the following SQL statements get executed:B
sA
B
sWe should improve this in multiple ways:
B
s and only delete those not longer presentUse batched statements for inserts (and updates)This is implemented.B
s. There are various possibilities how to do thisAlso, performancetests would be nice and probably a good first step.
Create separate issues to work on any of these. Use this issue to discuss these and other strategies to improve persisting performance.
Jens Schauder opened this ticket as DATAJDBC-210
The text was updated successfully, but these errors were encountered: