OwnerCurator extends AbstractHibernateCurator<Owner> { @Transactional @Override public Owner create(Owner entity) { return super.create(entity); } OwnerCurator(); Owner findOwnerById(String ownerId); @Transactional Owner replicate(Owner owner); @Transactional @Override Owner create(Owner entity); @Transactional Owner getByKeySecure(String key); Owner lockAndLoadByKey(String key); @Transactional Owner getByKey(String key); @Transactional CandlepinQuery<Owner> getByKeys(Collection<String> keys); Owner getByUpstreamUuid(String upstreamUuid); CandlepinQuery<Owner> getOwnersByActiveProduct(Collection<String> productIds); @SuppressWarnings("checkstyle:indentation") CandlepinQuery<Owner> getOwnersWithProducts(Collection<String> productIds); CandlepinQuery<String> getConsumerIds(Owner owner); @SuppressWarnings("unchecked") CandlepinQuery<String> getConsumerIds(String ownerId); CandlepinQuery<String> getConsumerUuids(Owner owner); @SuppressWarnings("unchecked") CandlepinQuery<String> getConsumerUuids(String ownerId);  }
@Test public void upstreamUuidConstraint() { UpstreamConsumer uc = new UpstreamConsumer("sameuuid"); Owner owner1 = new Owner("owner1"); owner1.setUpstreamConsumer(uc); Owner owner2 = new Owner("owner2"); owner2.setUpstreamConsumer(uc); assertThrows(PersistenceException.class, () -> ownerCurator.create(owner1)); }