我的列族有两个主键
"CREATE TABLE compositkeys(user_name varchar," +
"user_id int,"+
"name varchar," +
"gender varchar," +
"PRIMARY KEY (user_name,user_id)" +
")";
我已经用Java创建了这个现在我在一个用户名(sunil)主键上插入了6行,现在当我尝试检索sunil主键中的所有值时,它只给了我一个细节
String qry = "select * from compositkeys where user_name = 'sunil' order by user_id";
Statement smt = con.createStatement();
//smt.executeUpdate(qry);
ResultSet rs = smt.executeQuery(qry);
//rs.get
int r = rs.getRow();
System.out.println(r);
ResultSetMetaData rm = rs.getMetaData();
int columnCount = rm.getColumnCount();
System.out.println(columnCount);
for(int i=1;i<=columnCount;i++)
{
String name = rm.getColumnName(i);
System.out.print(rm.getColumnName(i));
System.out.println(" = "+rs.getString(name));
System.out.println("--------------------------------------------------");
}
它只给我一个输出。查询有什么问题吗?我想要密钥 sunil 下的所有数据。