Generate a script to create a table from the entity definition

Viewed 1152

Is there a way to generate the statement CREATE TABLE from an entity definition? I know it is possible using Achilles but I want to use the regular Cassandra entity.

The target is getting the following script from the entity class below.

Statement

CREATE TABLE user (userId uuid PRIMARY KEY, name text);

Entity

@Table(keyspace = "ks", name = "users",
       readConsistency = "QUORUM",
       writeConsistency = "QUORUM",
       caseSensitiveKeyspace = false,
       caseSensitiveTable = false)
public static class User {
    @PartitionKey
    private UUID userId;
    private String name;
    // ... constructors / getters / setters
}
2 Answers
Related