-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate and JDK 8
PostPosted: Wed Aug 06, 2014 5:06 pm 
Newbie

Joined: Wed Aug 06, 2014 4:42 pm
Posts: 1
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?


Last edited by jmnarloch on Fri Aug 15, 2014 12:29 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Hibernate and JDK 8
PostPosted: Fri Aug 15, 2014 7:11 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
I love your idea, and I guess there is much more we could do.

I've notified the developer's mailing list, would be great if you could join us there: http://lists.jboss.org/pipermail/hibernate-dev/2014-August/011657.html
Registration details, and IRC channels are described here: http://hibernate.org/community/

The main problem we are facing is that we have an extremely large user base which isn't moving to Java8 yet, so the "classical API" needs to be available for longer and be compiled with JDK7 compatibility.

We can of course create a new module, I expect this would initially include some kind of syntax translation - also to allow for quick turnarounds and fast improvements - wrapping the classical module. In a second phase we could improve the integration to bypass the classical API and expose internals more efficiently, possibly by then we might be ready to merge the module and baseline on Java8.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.