public PreparedStatement prepareInsert(Session session, EntityMeta entityMeta, List<PropertyMeta> pms, Options options) {
log.trace("Generate prepared statement for INSERT on {}", entityMeta);
PropertyMeta idMeta = entityMeta.getIdMeta();
final EntityMetaConfig metaConfig = entityMeta.config();
Insert insert = insertInto(metaConfig.getKeyspaceName(), metaConfig.getTableName());
if (options.isIfNotExists()) {
insert.ifNotExists();
}
idMeta.forStatementGeneration().generateInsertPrimaryKey(insert);
for (PropertyMeta pm : pms) {
String cql3ColumnName = pm.getCQL3ColumnName();
insert.value(cql3ColumnName, bindMarker(cql3ColumnName));
}
final Insert.Options insertOptions = insert.using(ttl(bindMarker("ttl")));
if (options.getTimestamp().isPresent()) {
insertOptions.and(timestamp(bindMarker("timestamp")));
}
return session.prepare(insert.getQueryString());
}