DeletedConsumerCurator extends AbstractHibernateCurator<DeletedConsumer> { @SuppressWarnings("unchecked") public CandlepinQuery<DeletedConsumer> findByOwnerId(String oid) { DetachedCriteria criteria = DetachedCriteria.forClass(DeletedConsumer.class) .add(Restrictions.eq("ownerId", oid)) .addOrder(Order.desc("created")); return this.cpQueryFactory.<DeletedConsumer>buildQuery(this.currentSession(), criteria); } DeletedConsumerCurator(); DeletedConsumer findByConsumer(Consumer c); DeletedConsumer findByConsumerUuid(String uuid); CandlepinQuery<DeletedConsumer> findByOwner(Owner o); @SuppressWarnings("unchecked") CandlepinQuery<DeletedConsumer> findByOwnerId(String oid); int countByConsumer(Consumer c); int countByConsumerUuid(String uuid); @SuppressWarnings("unchecked") CandlepinQuery<DeletedConsumer> findByDate(Date date);  }
@Test public void byOwnerId() { List<DeletedConsumer> found = dcc.findByOwnerId("10").list(); assertEquals(2, found.size()); }
@Test public void descOrderByOwnerId() { DeletedConsumer newest = dcc.findByOwnerId("10").list().get(0); assertEquals("fghij", newest.getConsumerUuid()); }