DeletedConsumerCurator extends AbstractHibernateCurator<DeletedConsumer> { public int countByConsumerUuid(String uuid) { return ((Long) currentSession().createCriteria(DeletedConsumer.class) .add(Restrictions.eq("consumerUuid", uuid)) .setProjection(Projections.rowCount()).uniqueResult()).intValue(); } 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 countByConsumerId() { assertEquals(1, dcc.countByConsumerUuid("abcde")); assertEquals(0, dcc.countByConsumerUuid("dontfind")); assertEquals(1, dcc.countByConsumerUuid("fghij")); }