I can’t seem to do a `batchInsert` for a `List<...
# exposed
r
I can’t seem to do a
batchInsert
for a
List<T>
because
batchInsert
will only accept a
List<Any>
. Anyone else with that issue?
t
You could iterate through any collection within a transaction and insert each, all item would be batch-inserted together
👍 1
I never tried batchInsert though
t
@runjorel, batchInsert accepts typed list, not List<Any>. How do you use it?
r
I’ve got a feeling it was because I was programming something inside a generic interface. something akin to this:
Copy code
interface CrudRepository<T, ID>{
   val table: IdTable<ID>
....
fun saveAll(entities: List<T>) ...
   table.batchInsert( entities ){ .. }  // where I was getting compiler error for List<Any>
I could only fix it via casts
t
Try to use:
interface CrudRepository<T:Any, ID>{