title: Why would you prefer Java 8 Stream API instead of direct hibernate/sql queries when working with the DB
body: <p>Recently I see a lot of code in few projects using stream for filtering objects, like:</p>
  
  <pre><code>library.stream()
            .map(book -&gt; book.getAuthor())
            .filter(author -&gt; author.getAge() &gt;= 50)
            .map(Author::getSurname)
            .map(String::toUpperCase)
            .distinct()
            .limit(15)
            .collect(toList()));
  </code></pre>
  
  <p>Is there any advantages of using that instead of direct HQL/SQL query to the database returning already the filtered results.</p>
  
  <p>Isn't the second aproach much faster?</p>