【发布时间】:2016-12-27 18:42:51
【问题描述】:
使用框架Cassandra Achilles,它会生成下面的CQL,但它仅在键空间名称为小写时才有效
Session session = cluster.connect();
session.execute("DROP KEYSPACE IF EXISTS Smart;");
session.execute("CREATE KEYSPACE Smart WITH replication = { "
+ " 'class': 'SimpleStrategy', 'replication_factor': '3' }; ");
session.execute("CREATE TYPE IF NOT EXISTS smart.bio_udt("+
"birthplace text,"+
"diplomas list<text>,"+
"description text);");
session.execute("CREATE TABLE IF NOT EXISTS Smart.users("+
"id bigint,"+
"age_in_year int,"+
"bio frozen<\"Smart\".bio_udt>,"+
"favoritetags set<text>,"+
"firstname text,"+
"lastname text,"+
"preferences map<int, text>,"+
"PRIMARY KEY(id))");
出现错误:
com.datastax.driver.core.exceptions.InvalidQueryException:
Statement on keyspace smart cannot refer to a user type in keyspace Smart;
user types can only be used in the keyspace they are defined in
有什么问题?
【问题讨论】: