@Override
 @SuppressWarnings("unchecked")
 public List<Vulnerability> retrieveAllByGenericVulnerabilityAndApp(Vulnerability vulnerability) {
   return sessionFactory
       .getCurrentSession()
       .createQuery(
           "from Vulnerability vuln where vuln.application = :appId "
               + "and vuln.genericVulnerability = :gvId and vuln.expired = :false")
       .setInteger("gvId", vulnerability.getGenericVulnerability().getId())
       .setInteger("appId", vulnerability.getApplication().getId())
       .setBoolean("false", false)
       .list();
 }
 @Override
 @SuppressWarnings("unchecked")
 public List<Vulnerability> retrieveSimilarHashes(Vulnerability vulnerability) {
   return sessionFactory
       .getCurrentSession()
       .createQuery(
           "from Vulnerability vuln where vuln.application = :appId "
               + "and vuln.expired = :false "
               + "and (vuln.locationVariableHash = :lvHash or "
               + "vuln.locationHash = :lHash or vuln.variableHash = :vHash)")
       .setString("lvHash", vulnerability.getLocationVariableHash())
       .setString("lHash", vulnerability.getLocationHash())
       .setString("vHash", vulnerability.getVariableHash())
       .setInteger("appId", vulnerability.getApplication().getId())
       .setBoolean("false", false)
       .list();
 }