Query q = entityManager.createNamedQuery(PackageVersion.QUERY_FIND_PACKAGEVERSION_BY_FILENAME);
for (AdvisoryPackageDetails pkg : pkgs) {
try {
q.setParameter("rpmName", pkg.getRpmFilename());
PackageVersion pExisting = (PackageVersion) q.getSingleResult();
AdvisoryPackage apkg = advManager.findAdvisoryPackage(overlord, newAdv.getId(), pExisting
.getId());
if (apkg == null) {
apkg = new AdvisoryPackage(newAdv, pExisting);
entityManager.persist(apkg);
entityManager.flush();
}
} catch (NoResultException nre) {
log.info("Advisory has package thats not yet in the db [" + pkg.getRpmFilename()