@Test
	public void testCount() throws Exception
	{
		PersistenceManager persist = new PersistenceManager(driver, database, login, password);
		persist.dropTable(Object.class);

		ConnectionWrapper cw = persist.getConnectionWrapper();
		// add a large number of entries
		for (int x = 0; x < 200; x++)
		{
			SimplestObject so = new SimplestObject();
			if(x>50)
			{
				so.setFoo((double) x);
			}
			persist.saveObject(cw, so);
		}
		
		cw.commitAndDiscard();
		// make sure the right number of objects are returned
		long count = persist.getCount(new SimplestObject());
		assertEquals(200L, count);
		// select half of the objects
		SimplestObject selectObject = new SimplestObject();
		selectObject.setFoo(99.0);
		Greater g = new Greater(selectObject);
		count = persist.getCount(SimplestObject.class, g);
		assertEquals(100L, count);
		
		Number n = persist.calculateAggregate(SimplestObject.class, new Count("getFoo"),new All());
		assertEquals(149l,n);
		
		persist.close();
		
		
	}