Datastax 4.6 Java driver Object mapper async/batch query

Viewed 293

Datastax java driver 4.6 version I dont see support in object mapper for Batch/async queries

Is there any workaround for it? Any reason why objectmapper has no batch/async support?

Previous version there was MappingManager using which batch and async queries were suppported

1 Answers

Everything is regulated by return type of declared function:

  • For async versions, look for documentation for specific annotation, for example, @Insert, or @Select, etc.. But in all cases it's regulated by the return type of the declared function. To get async version you need to declare function with CompletionStage<SomeClass> or CompletableFuture<SomeClass> return type
  • Batching is similar - you declare function with BoundStatement return type, and put that bound statement into batch that is executed via session.execute, or session.executeAsync.
Related