1112131415161718
public TruncateQueryAsync(String keySpace) { super(keySpace); } public <T> void truncateAsync(Class<T> bean, Session session) { Truncate query = getQuery(bean); session.executeAsync(query.toString()); }
2223242526272829
* @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()); }
282930313233343536
session.execute(query.toString()); } protected <T> Truncate getQuery(Class<T> bean) { ClassInformation classInformation = ClassInformations.INSTACE .getClass(bean); Truncate query = QueryBuilder .truncate(keySpace, classInformation.getNameSchema()); return query; }
10071008100910101011101210131014
truncate(cqlId(tableName)); } @Override public void truncate(CqlIdentifier tableName) throws DataAccessException { Truncate truncate = QueryBuilder.truncate(tableName.toCql()); doExecute(truncate); }
1094109510961097109810991100110111021103
Insert insert = QueryBuilder.insertInto(tableName).value("id", uuid()).value("foo", "bar"); cqlTemplate.execute(insert); Truncate truncate = QueryBuilder.truncate(tableName); cqlTemplate.execute(truncate); }