Thread
#exposed
    r

    runjorel

    3 years ago
    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?
    tjohnn

    tjohnn

    3 years ago
    You could iterate through any collection within a transaction and insert each, all item would be batch-inserted together
    I never tried batchInsert though
    tapac

    tapac

    3 years ago
    @runjorel, batchInsert accepts typed list, not List<Any>. How do you use it?
    r

    runjorel

    3 years ago
    I’ve got a feeling it was because I was programming something inside a generic interface. something akin to this:
    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
    tapac

    tapac

    3 years ago
    Try to use:
    interface CrudRepository<T:Any, ID>{