ExporterMetadataCurator extends AbstractHibernateCurator<ExporterMetadata> { public ExporterMetadata getByTypeAndOwner(String type, Owner owner) { return (ExporterMetadata) this.currentSession().createCriteria(ExporterMetadata.class) .add(Restrictions.eq("type", type)) .add(Restrictions.eq("owner", owner)) .uniqueResult(); } @Inject  ExporterMetadataCurator(); ExporterMetadata getByType(String type); ExporterMetadata getByTypeAndOwner(String type, Owner owner);  }
@Test public void getByTypeAndOwner() { ExporterMetadata em = new ExporterMetadata(); Owner owner = createOwner(); em.setType(ExporterMetadata.TYPE_PER_USER); em.setExported(new Date()); em.setOwner(owner); ExporterMetadata emdb = emc.create(em); assertEquals(emdb, emc.getByTypeAndOwner( ExporterMetadata.TYPE_PER_USER, owner)); }