We have several classes for writing to and reading from our database layer in a Command-Query-Separation fashion.
Each of these classes are annotated with @Transactional respectively with @Transactional(readOnly = true).
Now we've implemented a data import which is creating many objects and writing them to the database using our command-layer.
For now, each write of a single object is done within its own transaction, and I am pretty sure that's a major performance killer.
Is there a simple way to annotate the data import class in a way, that even though it calls many @Transactional annotated methods in the command layer many times, all would be done in a single transaction?
Is this even a valid approach for improving insertion-performance, or would you consider this a bad idea?