Release release = releaseRepository.findByName("The Bodyguard (Original Soundtrack Album)").iterator().next();
ClassificationEntity classification = new ClassificationEntity();
classification.setName("Pop");
classification.setType(Classification.GENRE);
ClassificationReferenceEntity classificationReference = new ClassificationReferenceEntity();
classificationReference.setReferenceTo(SMDIdentityReferenceEntity.forEntity(release));
classificationReference.setLastUpdated(new Date());
classificationReference.setLastUpdatedBy("JUnit");
classification.addReference(classificationReference);
classification.setLastUpdated(new Date());
classification.setLastUpdatedBy("JUnit");
for (Track track : release.getTracks()) {
classificationReference = new ClassificationReferenceEntity();
classificationReference.setReferenceTo(SMDIdentityReferenceEntity.forEntity(track));
classificationReference.setLastUpdated(new Date());
classificationReference.setLastUpdatedBy("JUnit");
classification.addReference(classificationReference);
}
classificationRepository.create(classification);
Collection<ClassificationEntity> classifications = classificationRepository.findByNameAndType("Pop", Classification.GENRE);