@Test
	public void testSubClauses() throws Exception
	{
		PersistenceManager pm = new PersistenceManager(driver,database,login,password);
		ConnectionWrapper cw = pm.getConnectionWrapper();
		//add data with two sortable fields
		for(int x = 0;x<100;x++)
		{
			long dec = x/10;
			double rem = x%10;
			SimpleObject so = new SimpleObject();
			so.setAge(dec);
			so.setScale(rem);
			pm.saveObject(cw,so);
		}
		cw.commitAndDiscard();
		SimpleObject sortAge=new SimpleObject();
		sortAge.setAge(1l);
		SimpleObject sortScale=new SimpleObject();
		sortScale.setScale(1.0);
		List<SimpleObject> list = pm.getObjects(SimpleObject.class,new All(),new Order(new Ascending(sortAge),new Descending(sortScale)));

		for(int x = 0;x<list.size()-1;x++)
		{
			SimpleObject curr = list.get(x);
			SimpleObject next = list.get(x+1);
			if(curr.getAge().longValue()==next.getAge().longValue())
			{
				//we sorted scale descending
				assertTrue(curr.getScale()>next.getScale());
			}
			else
			{
				//we sorted age ascending
				assertEquals((long)curr.getAge()+1,(long)next.getAge());
				assertEquals((double)curr.getScale()+9,(double)next.getScale(),0.00001);
			}
		}
		
		list = pm.getObjects(SimpleObject.class,new All(),new Order(new Ascending(sortAge),new Ascending(sortScale)));

		for(int x = 0;x<list.size()-1;x++)
		{
			SimpleObject curr = list.get(x);
			SimpleObject next = list.get(x+1);
			if(curr.getAge().longValue()==next.getAge().longValue())
			{
				//we sorted scale descending
				assertTrue(curr.getScale()<next.getScale());
			}
			else
			{
				//we sorted age ascending
				assertEquals((long)curr.getAge()+1,(long)next.getAge());
				assertEquals((double)curr.getScale()-9,(double)next.getScale(),0.00001);
			}
		}
	
		pm.close();
	}