/** * Creates a new {@code TRUNCATE} query. * * @param table the name of the table to truncate. * @return the truncation query. */ public static Truncate truncate(String table) { return new Truncate(null, table); }
/** * Remove all entities from cassandra database. */ public void removeAll() { Statement truncate = QueryBuilder.truncate(getColumnFamilyName()) .setConsistencyLevel(getWriteConsistencyLevel()); session.execute(truncate); }
Truncate(TableMetadata table) { super(table); this.table = escapeId(table.getName()); }
/** * This method returns the CQL query to truncate (removes all the data) in the table. * refer : http://docs.datastax.com/en/cql/3.1/cql/cql_reference/truncate_r.html * * @param mapping Cassandra Mapping {@link CassandraMapping} * @return CQL query */ static String getTruncateTableQuery(CassandraMapping mapping) { return QueryBuilder.truncate(mapping.getKeySpace().getName(), mapping.getCoreName()).getQueryString(); }
/** *truncate the column family. * @param bean the kind of object * @param session the session * @param <T> the kind of object */ public <T> void truncate(Class<T> bean, Session session) { Truncate query = getQuery(bean); session.execute(query.toString()); } protected <T> Truncate getQuery(Class<T> bean) {
/** * This method returns the CQL query to truncate (removes all the data) in the table. * refer : http://docs.datastax.com/en/cql/3.1/cql/cql_reference/truncate_r.html * * @param mapping Cassandra Mapping {@link CassandraMapping} * @return CQL query */ static String getTruncateTableQuery(CassandraMapping mapping) { return QueryBuilder.truncate(mapping.getKeySpace().getName(), mapping.getCoreName()).getQueryString(); }
/** * Creates a new {@code TRUNCATE} query. * * @param keyspace the name of the keyspace to use. * @param table the name of the table to truncate. * @return the truncation query. */ public static Truncate truncate(String keyspace, String table) { return new Truncate(keyspace, table); }
public <T> void truncateAsync(Class<T> bean, Session session) { Truncate query = getQuery(bean); session.executeAsync(query.toString()); }
/** * Creates a new {@code TRUNCATE} query. * * @param table the table to truncate. * @return the truncation query. */ public static Truncate truncate(TableMetadata table) { return new Truncate(table); }
/** * Creates a new TRUNCATE query. * * @param table the table to truncate. * @return the truncation query. */ public static Truncate truncate(TableMetadata table) { return new Truncate(table); }
/** * Creates a new TRUNCATE query. * * @param keyspace the name of the keyspace to use. * @param table the name of the table to truncate. * @return the truncation query. */ public static Truncate truncate(String keyspace, String table) { return new Truncate(keyspace, table); }
/** * Creates a new TRUNCATE query. * * @param table the name of the table to truncate. * @return the truncation query. */ public static Truncate truncate(String table) { return new Truncate(null, table); }
/** * Creates a new TRUNCATE query. * * @param table the name of the table to truncate. * @return the truncation query. */ public static Truncate truncate(String table) { return new Truncate(null, table); }
/** * Creates a new TRUNCATE query. * * @param table the name of the table to truncate. * @return the truncation query. */ public static Truncate truncate(String table) { return new Truncate(null, table); }
/** * Creates a new TRUNCATE query. * * @param table the table to truncate. * @return the truncation query. */ public static Truncate truncate(TableMetadata table) { return new Truncate(table); }
/** * Creates a new TRUNCATE query. * * @param keyspace the name of the keyspace to use. * @param table the name of the table to truncate. * @return the truncation query. */ public static Truncate truncate(String keyspace, String table) { return new Truncate(keyspace, table); }