EmpireBatchDao extends EmpireDao implements BatchDao { @Override public List<Batch> findLoadingBatches() { BeanResult<Batch> result = new BeanResult<Batch>(Batch.class, table); result.getCommand().where(table.state.is(State.LOADING)); result.fetch(getConnection()); return Collections.unmodifiableList(result); } EmpireBatchDao(ProarcDatabase db); @Override Batch create(); @Override void update(Batch batch); @Override Batch find(int batchId); @Override Batch findForPid(String pid); @Override List<Batch> findLoadingBatches(); @Override List<BatchView> view(Integer userId, Integer batchId, State state, int offset); @Override List<BatchView> view(Integer userId, Integer batchId, Set<State> state,
            Timestamp from, Timestamp to, int offset, int maxCount, String sortBy); @Override List<BatchView> view(BatchViewFilter filter);  }
@Test public void testFindLoadingBatches() throws Exception { IDataSet db = database( support.loadFlatXmlDataStream(getClass(), "user.xml"), support.loadFlatXmlDataStream(getClass(), "batch.xml") ); support.cleanInsert(support.getConnection(tx), db); tx.commit(); List<Batch> result = dao.findLoadingBatches(); assertEquals(2, result.size()); Batch batch = dao.find(1); batch.setState(State.LOADED); dao.update(batch); result = dao.findLoadingBatches(); assertEquals(1, result.size()); }