【发布时间】:2014-11-17 22:42:58
【问题描述】:
我有这个代码
UUID notUuid = UUIDs.timeBased();
PreparedStatement pstmt = cqlSession.prepare("INSERT INTO mytable(userId, notifId, notification, time, read, deleted) VALUES(?, ?, ?, ?, ?, ?)");
BoundStatement boundStatement = new BoundStatement(pstmt);
cqlSession.execute(boundStatement.bind(userId, notUuid, notfMsg, System.currentTimeMillis(), MigificConstants.UNREAD, "false"));
当我运行这段代码时,它会在日志中显示
Re-preparing already prepared query INSERT INTO mytable(userId, notifId, notification, time, read, deleted) VALUES(?, ?, ?, ?, ?, ?). Please note that preparing the same query more than once is generally an anti-pattern and will likely affect performance. Consider preparing the statement only once.
【问题讨论】:
-
这是答案:[在使用 Datastax Cassandra 驱动程序时重用 PreparedStatement?][1] [1]:stackoverflow.com/questions/22915840/…