}
public void testSelectQueryOrdering() throws Exception {
createTwoMtTable1sAnd2sDataSet();
SelectQuery q = new SelectQuery("MtTable1");
q.addOrdering(ClientMtTable1.GLOBAL_ATTRIBUTE1_PROPERTY, SortOrder.ASCENDING);
List<?> results = context.performQuery(q);
assertEquals(2, results.size());
ClientMtTable1 o1 = (ClientMtTable1) results.get(0);
ClientMtTable1 o2 = (ClientMtTable1) results.get(1);
assertTrue(o1.getGlobalAttribute1().compareTo(o2.getGlobalAttribute1()) < 0);
// now run the same query with reverse ordering to check that the first ordering
// result wasn't coincidental.
q.clearOrderings();
q.addOrdering(ClientMtTable1.GLOBAL_ATTRIBUTE1_PROPERTY, SortOrder.DESCENDING);
List<?> results1 = context.performQuery(q);
assertEquals(2, results1.size());
ClientMtTable1 o3 = (ClientMtTable1) results1.get(0);