Class SqlProviderAdapter


  • public class SqlProviderAdapter
    extends Object
    Adapter for use with MyBatis SQL provider annotations.
    Author:
    Jeff Butler
    • Constructor Detail

      • SqlProviderAdapter

        public SqlProviderAdapter()
    • Method Detail

      • insertMultipleWithGeneratedKeys

        public String insertMultipleWithGeneratedKeys​(Map<String,​Object> parameterMap)
        This adapter method is intended for use with MyBatis' @InsertProvider annotation when there are generated values expected from executing the insert statement. The canonical method signature for using this adapter method is as follows:
         public interface FooMapper {
             @InsertProvider(type=SqlProviderAdapter.class, method="insertMultipleWithGeneratedKeys")
             @Options(useGeneratedKeys=true, keyProperty="records.id")
             int insertMultiple(String insertStatement, @Param("records") List<Foo> records)
         }
         
        Parameters:
        parameterMap - The parameter map is automatically created by MyBatis when there are multiple parameters in the insert method.
        Returns:
        the SQL statement contained in the parameter map. This is assumed to be the one and only map entry of type String.