0

I have been using open source data set provider Casper to achieve in-memory representation of a collection of Database objects in Java.

Github Repository : https://github.com/casperds/casperdatasets

Below is the code that I have been using to pull data in Casper datasets

 String[] primaryKeys = { "QUESTION_ID" };   
 if (resultSet != null) 
    {
      container = CDataCacheDBAdapter.loadData(resultSet, null, primaryKeys,new HashMap<Object, Object>());
      lCDataRowset = container.getAll();
      preparedStatement.close();
      resultSet.close();
    }

The problem with using this is, when I don't mention primary keys then DBAdapter does not load data. And If I mention some column as primary keys then "Order By" does not have effect in the dataset. It just orders by primary keys.

I want to be able to pull data in dataset in order the way I have mentioned in the query.

Did anybody face this issue? Any kind of help is appreciated!! Thanks

Shadow
  • 33,525
  • 10
  • 51
  • 64
Fahad Mullaji
  • 1,332
  • 5
  • 15
  • 30

1 Answers1

1

Well it turned out to be very stupid issue. If you pass null for primaryKeys parameter then it returns data in the order the way it returns in MySQL query browser.

I thought this could help someone someday. That's why keeping this post other wise I would have deleted it.

Fahad Mullaji
  • 1,332
  • 5
  • 15
  • 30