Is there a way to bulk insert values into a List element collection?
This is a sample of the entity:
public Class File{
private String name;
@ElementCollection
@CollectionTable(name="file_tags")
private List<String> tags = new ArrayList<>();
.....
}
I Need to add a list of tags to a large number of files (hundred of thousands)... That's why I am looking for a way to do it in a bulk insert... I searched with no result till now.
Note that I am using eclipselink as JPA provider.
you have to enable batch writing by adding these 2 properties inside your persistence.xml
<!-- Enable batch writing -->
<property name="eclipselink.jdbc.batch-writing" value="JDBC"/>
<!-- Batch size -->
<property name="eclipselink.jdbc.batch-writing.size" value="100"/>