Speedment framework


Pre Java 8:

List<Hare> hares = session.createQuery("SELECT h FROM Hare h", Hare.class).getResultList();
for (Hare hare : hares) {
  if (hare.getId() == 1) {
    System.out.println(hare.getName());
  }
}


With Java 8 aware Hibernate 5.2:
List<Hare> hares = session.createQuery("SELECT h FROM Hare h", Hare.class).getResultList();
hares.stream().filter(h -> h.getId() == 1).forEach(h -> System.out.println(h.getName()));



With Speedment
hares.stream().filter(h -> h.getId() == 1).map(Hare::getName).forEach(System.out::println);



??? what happened?
How could that work ?!! Where is the query ?!

“In the Speedment framework, the resulting SQL query is the responsibility of the framework. Thus, a program leveraging Speedment does not use any explicit query language. Instead, all the data operations are expressed as a pipeline of operations on a stream of data and the framework will create the SQL query.

See more here:


Comments