English 中文(简体)
Slice Query in Hector API for cassandra DB sediments HInvalidRequestException: InvalidRequestException (why:Key may not be open)
原标题:SliceQuery in Hector API for cassandra DB throws HInvalidRequestException: InvalidRequestException(why:Key may not be empty)

我有用户名和密码,作为使用Name的ColumnFamily的一栏。

create column family TestUserInfo with comparator = UTF8Type with column_metadata = [{column_name: username, validation_class:UTF8Type}, {column_name: password, validation_class:UTF8Type} ];

下面的法典规定,如果钥匙存在于b布,则将处以罚款。 鉴于扔下了我,在钥匙没有存在的情况下,pre倒了。

    SliceQuery<String, String, String> sliceQuery = HFactory.createSliceQuery(cassandraDBObject.getKeyspace(), StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
    sliceQuery.setColumnFamily("TestUserInfo");
    sliceQuery.setKey(userName);
    sliceQuery.setColumnNames("username", "password");
    String userNameFromDB = null;
    String passwordFromDB = null;
    try {
        [Error here -->] QueryResult<ColumnSlice<String, String>> queryResult = sliceQuery.execute();
        ColumnSlice<String, String> resultCol = queryResult.get();
        System.out.println(resultCol);
        userNameFromDB = resultCol.getColumnByName("username").getValue();
        passwordFromDB = resultCol.getColumnByName("password").getValue();
    } catch (Exception e) {
        e.printStackTrace();
    }

你们能够告诉我,我究竟是错了吗? 还是这种预期行为? 如果是这样的话,如何控制空洞的结果? Saye 我正在从db中核对记录信息。 如果用户Name(Key)没有干 the,那么就需要获得空出的结果?

感谢!

最佳回答

令我感到放心的是,我抱怨说,你再次给它一个空洞或没有用处的人。

问题回答

暂无回答




相关问题
C# SQLServer retrieving results and place in a .csv format

I had a look on the site and on Google, but I couldn t seem to find a good solution to what I m trying to do. Basically, I have a client server application (C#) where I send the server an SQL select ...

j子中 cur子的 cur子

我有这样的情况,即我使用的第3个政党开放源产品从Oracle的 cur子中挥发,并收到错误:java.sql.SQLException: ORA-01000:最大开场治疗器超过顶

Java Iterator backed by a ResultSet

I ve got a class that implements Iterator with a ResultSet as a data member. Essentially the class looks like this: public class A implements Iterator{ private ResultSet entities; ... ...

pass ResultSet from servlet to JSP

I am doing the following in my SampleServlet.java //Fill resultset from db .... try { ArrayList Rows = new ArrayList(); while (resultSet.next()){ ArrayList row = new ArrayList(); ...

How to correctly use ResultSet with h:dataTable

The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...