Cassandra SimpleStatement 受保护的构造函数

Cassandra SimpleStatement protected constructor

我正在使用 DataStax Java 驱动程序 3.0.0-alpha4 for cassandra with Scala。以下不编译:

object Test {
 def get = {
   val stmt = new SimpleStatement("query")
   CassandraConnector.session.execute(stmt)
 }
}

我得到的错误是:

Access to protected constructor SimpleStatement not permitted because [error] enclosing object Test in package cassandra is not a subclass of [error] class SimpleStatement in package core where target is defined

但是使用 BoundStatement 或 PreparedStatement 效果很好。

Java 驱动 3.0.0-rc1 中的问题已解决,public 构造函数返回

对于更早的 3.0.0-x 版本,使用 session.newSimpleStatement(codecRegistry, protocolVersion)