Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public Object doInSession(Session s) throws DataAccessException {
}

public void dropTable(Class<?> entityClass) {
dropTable(determineTableName(entityClass));
dropTable(getTableName(entityClass));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,6 @@ public <T> Cancellable updateAsynchronously(T entity, WriteListener<T> listener,
return doUpdateAsync(entity, listener, options);
}

protected <T> CqlIdentifier determineTableName(T obj) {
return obj == null ? null : determineTableName(obj.getClass());
}

protected <T> List<T> select(final String query, CassandraConverterRowCallback<T> readRowCallback) {

ResultSet resultSet = doExecute(new SessionCallback<ResultSet>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,19 @@ public void testCreateTables() throws Exception {
cassandraAdminTemplate.createTable(true, CqlIdentifier.cqlId("book"), Book.class, null);
assertThat(getKeyspaceMetadata().getTables().size(), is(1));
}

@Test
public void testDropTable() throws Exception {

cassandraAdminTemplate.createTable(true, CqlIdentifier.cqlId("book"), Book.class, null);
assertThat(getKeyspaceMetadata().getTables().size(), is(1));

cassandraAdminTemplate.dropTable(Book.class);
assertThat(getKeyspaceMetadata().getTables().size(), is(0));

cassandraAdminTemplate.createTable(true, CqlIdentifier.cqlId("book"), Book.class, null);
cassandraAdminTemplate.dropTable(CqlIdentifier.cqlId("book"));

assertThat(getKeyspaceMetadata().getTables().size(), is(0));
}
}