Batch insertion using object mapper in Cassandra

Viewed 3511

Using cassandra object mapper api wanted to do a batch persist.

for single object it's working fine.

Mapper<MyObj> mapper = new MappingManager(getSession()).mapper(MyObj.class);
mapper.save(myObj);

For batch update I tried in this way, but ideally Cassandra is thinking I am persisting a list so it's giving exception like @Table annotation was not found in List, which is the expected behavior

Mapper<List<MyObj>> mapper = new MappingManager(getSession()).mapper(List.class);
myObjList.add(myObj1)
myObjList.addd(myObj2)
mapper.save(myObjList);

Is there a way to achieve the same in cassandra using batch?

NOTE: Alternatively I can do this by repeating the first step using for loop, but I am looking for a Batch insertions @ObjectMapper.

2 Answers
Related