How to use ActiveObjects to perform insert and update operations in batches?

lamella May 11, 2023

As the title shows, I currently need to insert or update more than 10,000 pieces of data at one time, and the current RawEntity entity class only provides the function of inserting or updating a single piece of data. How can I implement batch insert or update data operations?

1 answer

1 accepted

0 votes
Answer accepted
Robert Lichman {Appfire} June 21, 2023

To batch insert you can use create for list available probably in AO version >=3.x

<T extends RawEntity<K>, K> void create(Class<T> var1, List<Map<String, Object>> var2); 

I would like to join the question about batch update. Is there any option to save in batch instead of using save method from RawEntity class?

lamella July 18, 2023

Hi @Robert Lichman {Appfire} 

    I used the same solution as you for batch insertion. In the previous plug-in development work, my ao version was only 1.2.x, which prevented me from discovering this batch saving method.
    Regarding batch update, I don't have any good ideas to implement it. Maybe we can re-implement the underlying logic of ao and add a batch update method?
    If you have any good ideas, please feel free to contact me at lamella@skyln.cn
Sincere blessing

:-)

Suggest an answer

Log in or Sign up to answer