Class BatchInsertUtility

java.lang.Object
org.mybatis.dynamic.sql.util.spring.BatchInsertUtility

public class BatchInsertUtility extends Object
Utility class for converting a list of rows to an array or SqlParameterSources.

This class is necessary due to the way that the library generates bindings for batch insert statements. The bindings will be of the form :row.propertyName. The createBatch method in this class will wrap all input rows in a class - RowHolder - with a single property named "row". This will allow the generated bindings to function properly with a Spring batch insert.

  • Method Details

    • createBatch

      public static <T> org.springframework.jdbc.core.namedparam.SqlParameterSource[] createBatch(List<T> rows)