Today I had this stunning idea, how cool would it be to access my Hibernate Query result with a Java 8 stream manner.
I begun to wonder, not able to find any regarding article or discussion -
Do you have any plans for moving the Hibernate interface to Java 8?
For instance adding support for java.lang.Optional or accessing the query results through Stream API. As a sneak peak I could figure out at least a couple of exaples of such API:
Code:
Optional<Event> optional = session.getOptional(Event.class, id);
// or through Query interface
Optional<Event> optional = session.createQuery("from Event where id = :id").setParameter("id", id).optionalResult();
Code:
List<Event> events = session.createQuery("from Event")
.stream()
.filter(e -> e.getTitle == "Java 8") // does some optional filtering or any other operation on the result set
.collect(Collectors.toList())
Additionally I could think of using streams and lambdas to be used for building the query in manner similar like the LINQ does, although this would be probably be an idea for an entirely new project ;)
So I was mostly interested what is your opinion and plans on this matter?