doma icon indicating copy to clipboard operation
doma copied to clipboard

Feature Request: Bulk Insert

Open orekyuu opened this issue 1 year ago • 1 comments

Description Currently, Doma2 does not support Bulk Insert. Currently, to achieve Bulk Insert, it is necessary to write an SQL Template like the following:

insert into users(name, age)
values /*%for e : entities*/
  (/*e.name*/'user', /*e.age*/20)
  /*%if e_has_next */ /*# "," */ /*%end */
/*%end */

Implementation ideas We would like to be able to write it as follows:

interface UserDao {
  @BulkInsert
  int bulkInsert(List<UserEntity> users);

  @BulkInsert
  BulkResult<ImmutableUserEntity> bulkInsert(List<ImmutableUserEntity> users);
}

If there are no problem, I would like to try writing a Pull Request to add this feature.

orekyuu avatar Jun 29 '24 12:06 orekyuu

Thank you for your feedback. Your pull requests are welcome.

nakamura-to avatar Jun 29 '24 12:06 nakamura-to