Accountability extends AbstractEntity { @SuppressWarnings("rawtypes") public static <T extends Accountability> List<T> findAccountabilities(Class<T> accountabilityClass, Date date) { return getRepository().createCriteriaQuery(accountabilityClass).le("fromDate", date).gt("toDate", date).list(); } protected  Accountability();  Accountability(C commissioner, R responsible, Date fromDate); C getCommissioner(); R getResponsible(); Date getFromDate(); Date getToDate(); @Override String[] businessKeys(); void terminate(Date date); @SuppressWarnings("rawtypes") static List<T> findAccountabilities(Class<T> accountabilityClass, Date date); @SuppressWarnings("rawtypes") static List<Accountability> findAccountabilitiesByParty(Party party, Date date);  }
@SuppressWarnings("rawtypes") @Test public final void testFindAccountabilities() { OrganisationUtils organisationUtils = new OrganisationUtils(); Date date = DateUtils.date(2012, 1, 3); Company company = organisationUtils.createCompany("总公司", date); Department financial = organisationUtils.createDepartment("财务部", company, date); Employee employee = organisationUtils.createEmployee("张三", date); Employment employment = new Employment(company, employee, date); employment.save(); List<Accountability> results = Accountability.findAccountabilities(Accountability.class, date); OrgLineMgmt lineMgmt = OrgLineMgmt.getByResponsible(financial, date); assertTrue(results.contains(lineMgmt)); assertTrue(results.contains(employment)); }