Пример #1
0
  @Override
  public List<Media> getMediaReadForAlbum(Album album, User utilisateurCourant) {
    String request =
        "SELECT m "
            + " FROM Media as m"
            + " WHERE m.album.id=? "
            + " and exists ("
            + "	from LectureAlbum as l where l.utilisateur.login=? and l.mediaVu = m"
            + " )";
    List<Media> medias =
        this.getHibernateTemplate().find(request, album.getId(), utilisateurCourant.getLogin());

    return medias;
  }
Пример #2
0
  @Override
  public boolean isAlbumHasNotSeeMedia(Album album, User utilisateurCourant) {
    String request =
        "SELECT m "
            + " FROM Media as m"
            + " WHERE m.album.id=? "
            + " and not exists ("
            + "	from LectureAlbum as l where l.utilisateur.login=? and l.mediaVu = m"
            + " )";
    List<Media> medias =
        this.getHibernateTemplate().find(request, album.getId(), utilisateurCourant.getLogin());

    return !medias.isEmpty();
  }