Tuesday Jul 07, 2015

JPA and Java SE 8 Streams

Retrieving a large, i.e. a very large, dataset using JPA might be tricky as the whole result set has to fit within a java.util.List instance. So a very large data set might potentially hit the memory limits of the sever the application is running on.

For those scenarios with (very) large result set, pagination can be used to work-around that limitation.  See for example this "How To Stream/Serialize JPA Result As JAX-RS Response For Large Data" article.  But for those scenarios, the Java 8 Streams API would also be a good fit! Unfortunately, Streams are not supported in the current release of JPA (JPA 2.1 - JSR 338) as it predates Java SE 8. But this is clearly a potential RFE for the next update of JPA (see this specification RFE here). In addition, some of the JPA implementations have already started to add support for Java 8 Streams (e.g. Hibernate and EclipseLink).

We will have to wait a bit more to see what the scope of 'JPA.next' will be. What do you think? Would you like to see Java SE 8 Streams supported in 'JPA.Next'?

Tuesday Mar 11, 2014

Java 8 Launch

JSR 337 who defines the content of Java SE 8 is now Final! That means that Java 8 is about to be released.

Over the coming months, a lot of events will take place across the globe to celebrate this important release.  Here's a recap of the initial Java 8 events that are taking place over the next 2 weeks.

NightHacking Java 8 Tour (March 11th - Apr 19th)

The NightHacking Java 8 Tour is the inaugural leg of the Java 8 Tour event where the Java SE evangelism team will be crossing the globe to speak at conferences and Java User Groups to spread the word about the new Java 8 release. See more info here.

Java 8 Day at EclipseCon (March 18th - San Francisco)

The Eclipse Foundation and Oracle are hosting a Java 8 Day at EclipseCon 2014. This will be a great opportunity for attendees to learn about the new Java 8 features and share in the excitement of the Java 8 launch. See more info here

Java 8 Launch Webcast (March 25th)

On March 25th (10am PST), Oracle will host a live webcast that will feature various speakers, panel discussions, several videos introducing the Java SE 8 features, a live chat, etc. Make sure to attend by registering here.

Be a part of it as we create the future with Java 8!

Tuesday Feb 04, 2014

Java SE 8 and Java EE 7

"Revolutions just spread blood. Evolution - this is something that changes in the long term." (Marjane Satrapi

Java SE 8 is scheduled for release next month, i.e. March 2014. From a Java EE point of view, the Java EE 7 specification requires at least Java SE 7. So clearly, nothing prevents you from using Java SE 8 with Java EE 7. A lot of us are in fact using early builds of Java SE 8 with GlassFish on a daily basis without any problem!

Project Avatar, which currently runs on top of GlassFish 4 (and Java SE 8), leverages one of the new Java 8 feature : Project Nashorn, a new lightweight high-performance JavaScript engine. 

The introduction of Lambdas Expressions is another key feature of Java 8. Lambdas basically add Closures support to the Java language, they allows to pass functionality as an argument to another method. Lambdas are seen as one of the most fundamental evolution in the Java platform since Generics (if not more important than Generics!). Lambdas leads to a different way of thinking, a different (and cleaner) way of writing code.

Java EE developers shouldn't wait and need to learn how to use Lambdas Expressions today as they are not incompatible with Java EE 7. Here is, for example, a post from Gerard Davison of the JDeveloper Team that shows Lambdas used with the WebSocket API.

If you are using Lambdas or any other Java SE 8 feature(s) today in Java EE, please let us know!

Thursday Nov 18, 2010

Majority or 2/3rds? The JSR Inception Votes by the EC

The Java Community Process 2.7 gives the Executive Committee the responsibility to "Select JSRs for development within the JCP", as in the case of the 4 JSRs that Oracle just submitted: 334 (Coin), 335 (Lambda), 336 (Java SE 7) and 337 (Java SE 8).

Yesterday I tried to explain how the rules work but I had to correct the section twice, so here it is again after talking with the PMO (Patrick Curran):

Applying the voting rules to the quartet, we have:

  • Coin and Lambda require that
       2/3rds of the votes cast are YES, there is a minimum of 5 YES votes, and Sun/Oracle must vote YES.
  • Java SE 7 and Java SE 8 require that
       2/3rds of the votes cast are YES, there is a minimum of 5 YES votes, and Sun/Oracle must vote YES.

Yes, the same rules for the 4 JSRs.

The rationale is that Coin and Lambda propose changes to the Java language, and that since Java SE 7 and Java SE 8 include them, they also change the language. The process document is a bit ambiguous about this and Patrick said they would clarify it for the next revision.