Friday Oct 23, 2015

DZone Survey Shows JPA Dominates Java Persistence

For those of us that have been around Java for a while it has been a long, hard road for Java persistence. In a relatively brief period of time we have seen a chaotic flux of persistence solutions - plain JDBC, homemade JDBC utilities, Apache Commons DBUtils, TopLink, Castor/JDO (Java Data Objects), EJB 2.x Entity Beans, iBatis, Spring JDBC, and so on. For most it was a relief that our industry seemed to finally converge on ORM as an imperfect but generally workable, productive solution to the very complex problem of persistence. For many others though persistence remains a highly contentious topic. It is not too surprising then that DZone took up the topic in it's wide ranging 2015 Java Ecosystem Survey. The analysis of the results of that survey will be part of the upcoming 2015 Java Ecosystem Guide to be published during JavaOne (you can register to get it here). Fortunately DZone shared the results with a selected set of MVBs (Most Valuable Bloggers) including yours truly and gave me permission to share some preview perspectives on the data. As the title of this entry suggests the survey results bode very well for JPA.

The survey asked a very simple question - "What persistence tools do you use today?". The answers included the survivors of the Java persistence wars past and some relative newcomers like jOOQ. The answers were mutually inclusive which was a wise choice that reflects reality. As the results highlighted shows, a very strong majority - almost 64% of developers voted for JPA. The closest contender lagging far behind at 37.6% was very old school plain JDBC!

Also very interesting was the fact that Hibernate native was a separate choice that received only about 17% percent of votes. This represents a successful transition from non-standard APIs to open standards based APIs. For context, even after achieving near de-facto dominant position in Java persistence the Hibernate team, Gavin King and Red Hat decided to standardize on JPA. The native Hibernate APIs were also maintained as a matter of legacy as well as a space for value-added features. For a while it was unclear whether the Hibernate community will opt to make the transition to JPA. This survey clearly shows the transition has happened, paving the way for continued healthy competition in the persistence space via JPA.

The surprisingly high usage of plain JDBC is notable as well. Clearly in this day and age one can do far better than using such a low level API. This data point represents an opportunity for further JPA adoption either through advocacy, migration or sensible evolution of the JPA open standard. It also represents an opportunity for more SQL-centric persistence solutions such as relative newcomer jOOQ.

Overall the survey shows a fairly mature Java persistence landscape that still has a few surprises in store for us all to keep an eye on.

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 '' will be. What do you think? Would you like to see Java SE 8 Streams supported in 'JPA.Next'?

Monday Jun 01, 2015

Java EE @ Voxxed Days Algiers

The inaugural Voxxed Days Algiers was held on May 23 in Algiers, Algeria. Besides the Devoxx and Voxxed brand, the event can be credited by and large to the grassroots efforts of the Algeria JUG as well as the neighboring Morocco JUG. I have to thank Morocco JUG leader Badr El Houari for cordially inviting me to the event and Algeria JUG leader Abderrazak Bouadma for making the trip a unique unforgettable experience. The event was a humble but profound first step in the right direction for Algerian developers. The event definitely had a strong Java EE showing.

I participated in the opening keynote and delivered three sessions on Java EE 8, using NoSQL in Java EE applications and testing Java EE applications with Arquillian. More details on the sessions and Voxxed Days Algiers, including slide decks and code, posted on my personal blog.

Thursday Mar 26, 2015

New book: "Web Development with Java and JSF"

During JavaLand, I had the pleasure to meet Michael Müller. Michael is well known in the German Java sphere as he wrote numerous articles for various IT medias. In addition, Michael is an avid JSF user and a JSF EG member.

Michael is currently writing a book titled "Web Development with Java and JSF". Since Michael is a passionate JSF user, JSF is obviously an important topic in his book. But this is not another book about JSF only. Michael's goal is to cover Web Application development at large. That means that different but related topics are also discussed through his book. There are for examples sections on JPA, Bean Validation, Responsive Design, ... Michael also plan to touch on subject such as Web Application testing with Selenium, etc.

Michael has decided to use “a more fair” publishing approach where the book has 2 prices: a minimum and a suggested price. Based on that, the potential buyer is free to decide how much he wants to pay. This approach gives the buyer the ability to decide how much s/he think the book is really worth but this also gives the author more financial rewards as there is no intermediary between the publisher and the author.

A great deal of the book has already been written (+240 pages) but Michael is planning to add extra content.  You can read a sample here. "Web Development with Java and JSF" is available in the usual eBook formats (PDF, Mobi, ePub) and once you've bought it, you are entitled to get the updated versions for free.

Wednesday Nov 12, 2014

Java EE @ NFJS Pacific Northwest Software Symposium Seattle

As some of you may be aware I recently joined the well-respected US based No Fluff Just Stuff (NFJS) Tour. The NFJS Pacific Northwest Software Symposium was held October 17 - 19 in Seattle, Washington.

I had five talks total over two days, more or less back-to-back. I did talks on Java EE 7/Java EE 8, the Cargo Tracker Java EE Blue Prints, JavaScript + Java EE, Java EE + NoSQL as well as WebSocket. More details, including slide decks and code as well as my NFJS tour schedule, posted on my personal blog.

Monday Nov 03, 2014

Java EE @ NFJS New England Software Symposium Boston

As some of you may be aware I recently joined the well-respected US based No Fluff Just Stuff (NFJS) Tour. The NFJS New England Software Symposium was held September 19 - 21 in Boston. This is one of the larger NFJS shows and attendance at the show and my sessions was pretty good. It is always encouraging to see the same folks attend more than one talk. On my way to the show I also stopped by at the Connecticut Java User Group. The JUG is led by my friend and co-author for EJB 3 in Action Ryan Cuprak. I've spoken at the JUG a number of times over the years and it was good to be back.

I had five talks total over two days, more or less back-to-back. I did talks on Java EE 7/Java EE 8, the Cargo Tracker Java EE Blue Prints, JavaScript + Java EE, Java EE + NoSQL as well as JMS 2. More details, including slide decks and code as well as my NFJS tour schedule, posted on my personal blog.

Monday Oct 27, 2014

MyBatis-CDI: Persistence Alternative for Java EE

ORM is a by and large proven technique that has been around for a long time now (believe it or not TopLink was created in the early nineties for Smalltalk and then ported to Java). It maximizes code flexibility and database independence while minimizing boilerplate code and allowing the construction of rich domain models. Even for relatively complex domain models and queries, ORM engines tend to generate better quality SQL optimized to the underlying database than the average Java developer would with considerable time and effort. This is precisely why JPA is the persistence standard for Java EE and why a majority of modern server-side applications use ORM (indeed almost every other major development platform including .NET and Ruby on Rails positions ORM as it's default persistence solution).

That being said, there can certainly be cases where using hand-written native SQL is necessary or desirable. Most people don't seem to realize it, but JPA has always included very good support for native queries to meet these use cases (JPA 2.1 now even includes formal support for stored procedures - the ultimate form of database bound query execution). If you weren't aware of this, you should definitely read Taudo Wenzel's excellent write-up on using JPA native queries to generate reports (a common use case for native queries).

In fact you have other options for native SQL centric persistence in Java EE applications. One of the nicest ones is MyBatis-CDI. It provides a very nice CDI based abstraction for MyBatis, making it extremely easy to use in Java EE applications (in case you are wondering MyBatis is the successor to the old iBatis project). Here is how simple MyBatis CDI code can look like:

In addition to JTA transactions, MyBatis-CDI also supports local transactions. I've personally also successfully used Apache Commons DbUtils with CDI to quickly port over a legacy application with tons of hand-written SQL to Java EE/GlassFish.

Friday Aug 22, 2014

Java EE @ NFJS Central Iowa Software Symposium Des Moines

As some of you may be aware I recently joined the well-respected US based No Fluff Just Stuff (NFJS) Tour. The NFJS Central Iowa Software Symposium was held August 8 - 10 in Des Moines. The Des Moines show is one of the smaller ones but still was good overall. It is one of the few events of it's kind that take place this part the country so it is extremely important.

I had five talks total over two days, more or less back-to-back. I had decent attendance for all my sessions and had many of the same folks staying for multiple sessions which is always a very good sign. I did talks on Java EE 7/Java EE 8, WebSocket, the Cargo Tracker Java EE Blue Prints, JavaScript + Java EE and NoSQL + Java EE. More details, including slide decks and code as well as my NFJS tour schedule, posted on my personal blog.

Friday Aug 15, 2014

Java EE@Java Day Taipei 2014

Java Day Taipei 2014 was held at the Taipei International Convention Center on August 1st. Organized by Oracle University, it is one of the largest Java developer events in Taiwan. This was another successful year for Java Day Taipei with a fully sold out venue. In addition to Oracle speakers like me, Steve Chin and Naveen Asrani, the event also featured a bevy of local speakers including Taipei Java community leaders. Topics included Java SE, Java EE, JavaFX and Big Data.

I delivered a keynote on Java EE 7/Java EE 8 as well as a talks on aligning the JavaScript ecosystem with Java EE 7 and using NoSQL solutions in Java EE applications. More details on the sessions and Java Days Taipei, including the slide decks and code, posted on my personal blog.

Tuesday Jun 10, 2014

Type Conversion in JPA 2.1

The Java Persistence 2.1 specification (JSR 338) adds support for various new features such as schema generation, stored procedure invocation, use of entity graphs in queries and find operations, unsynchronized persistence contexts, injection into entity listener classes, etc.

JPA 2.1 also add support for Type Conversion methods, sometime called Type Converter. This new facility let developers specify methods to convert between the entity attribute representation and the database representation for attributes of basic types.

For additional details on Type Conversion, you can check the JSR 338 Specification and its corresponding JPA 2.1 Javadocs. In addition, you can also check those 2 articles. The first article ('How to implement a Type Converter') gives a short overview on Type Conversion while the second article ('How to use a JPA Type Converter to encrypt your data') implements a simple use-case (encrypting data) to illustrate Type Conversion. Mission critical applications would probably rely on transparent database encryption facilities provided by the database but that's not the point here, this use-case is easy enough to illustrate JPA 2.1 Type Conversion.

Friday Apr 25, 2014

The JavaOne Java EE Track: Thanks, a Sneak Peek and an Invitation

As you know the JavaOne CFP is now closed. I want to take this opportunity to thank all of those that submitted their thoughtful topics and all those who considered submitting. We had the highest number of JavaOne CFP submissions in the recent few years. This is a testament to your passion for the Java community and it is a great start on the road to keeping JavaOne a true success.

In terms of the Java EE track we now have all the raw material we need to construct a strong selection. In the next few weeks we will be working hard with the review committee to carefully sort through all the submissions we have at hand. You should begin to hear back as to decisions on your submissions around early Summer.

I want to remind you now not to be discouraged if you don't get the response you are hoping for. You should remember that you are competing against some of the best and brightest of Java at a global scale - especially so in the Java EE track. As much as we would like for things to be perfect in the end all of this is also based on all too fallible human judgement applied through a fairly intricate process designed with checks, balances and fairness in mind. If your session does not get accepted this year, you should definitely consider honing your submissions and trying again next year. If you are indeed selected I hope you see it as the testament to your abilities and good fortune it truly is. Either way, I hope you will consider coming to JavaOne to experience the incredible talent, energy and intellect in the air.

Invited Speakers/A Sneak Peek
One of the things we are doing differently for JavaOne this year is that we have a small number of well-deserved invited speakers. Besides helping us put together some early content this is a great way to give credit to some of the folks in the community. The following are the folks we have the honor to invite to the Java EE track this year with a bit of a sneak peak about what they will be talking about (as some of you know we have also invited a small number of folks personally to submit via the normal CFP process in addition to these super stars):

Adam Bien needs little introduction. He has been a key Java EE advocate, author, JCP expert and Java Champion for a long time. His passion for Java EE, knowledge as a consultant and skill as a presenter have few parallels. Adam will be talking about just how lightweight Java EE application design can be and other topics.

David Blevins also needs few introductions. He is an excellent speaker, a long-time JCP expert, Java EE advocate and powerhouse developer behind the highly innovative Apache OpenEJB and TomEE projects. David just recently founded Tomitribe, a company offering commercial support for TomEE. David will be talking about exactly why Java EE is a game changer developers should be enthusiastic about and other topics.

Patrycja Wegrzynowicz is the founder and CTO of her own company, a strong technical mind, a JavaOne veteran and a regular speaker at many conferences worldwide. Just some of her interests include patterns/anti-patterns, security, persistence and performance tuning. Patrycja will be sharing her insight on performance tuning techniques for complex JPA 2.1 domain models and other topics. We anticipate her talk would be interesting and valuable to many of you.

Arun Gupta is the former "GlassFish Guy", prolific Java EE advocate, author and blogger. He now enjoys a well-deserved and coveted role as the head of developer advocacy at Red Hat. A great deal of the current success of the Java EE and GlassFish communities can be attributed to Arun's tireless hard work, boundless energy and infectious enthusiasm. We are very honored to have Arun talk about some lessons learned from real world Java EE 7 deployments and other topics.

Anatole Tresch is a key engineer at Credit Suisse and one of the few brave souls with enough initiative to lead JCP JSRs despite not working for a major technology vendor. We are very proud to invite Anatole to talk about the Java EE configuration effort that he is currently helping launch. He definitely deserves the support of the Java EE community and has much to offer in terms of insight on Java EE and the JCP. We look forward to seeing him at JavaOne.

Keep in mind that JavaOne is now already open for registration. There are definitely some advantages to registering early. JavaOne Content Chair Stephen Chin outlines the reasons in an excellent recent blog post.

I hope to see you all at JavaOne. In the meanwhile as always if you have any questions never hesitate to reach out.

Tuesday Apr 08, 2014

New book: EJB 3 in Action, Second Edition

'EJB3 in Action' is one of the reference books when it comes to this important area of Java EE. The second edition covering EJB 3.2 has just been published.

Over the years, the EJB specification has come a long way and has been greatly simplified but nevertheless EJB is still a large specification to grasp. This book is a great (and up-to-date!) introduction to the EJB Component Model. The book goes beyond just introducing EJBs in details as it also explains technologies related to EJB such as CDI and JPA (the older amongst us will remember that EJB, back in the days, used to also handle persistence). The book has also a full chapter devoted to WebSocket, a new important Java EE 7 technology. The final chapter of the book is devoted to a critical, some time over looked, topics: testing.

This is not a pure theoretical book as it really gives 2 views, it first introduce and explains EJBs but also JPA, CDI, etc. The book then explain how to use EJBs and the other technologies, how to put them in action! All in all, a great book to add to any Java EE 7 bookshelf!

Disclaimer: 'EJB 3 in Action' was co-authored by our own Reza Rahman. But to be honest, I was already praising the first edition of the book when Reza wasn't yet working for Oracle.

Friday Mar 21, 2014

Code PaLOUsa 2014 Trip Report

Code PaLOUsa 2014 took place 24-26 February in Louisville, Kentucky. Code PaLOUsa is a fairly unassuming conference with great quality farther away from the beaten paths. Topics covered included Java, .NET, JavaScript, mobile, methodology and Big Data/NoSQL. On my way to Kentucky, I was able to stop by at the Montgomery County (Maryland) JUG for a Java EE 7 session.

At Code PaLOUsa I delivered a talk on aligning Java EE with NoSQL as well as a talk on the Cargo Tracker Java EE/Domain-Driven Design Blue Prints project (this talk was recorded by InfoQ). More details, including slide decks and code, posted on my personal blog.

Thursday Feb 13, 2014

CodeMash 2014 Trip Report

CodeMash 2014 took place 7-10 January in Sandusky, Ohio. With another sold-out year, CodeMash is quickly becoming one of the largest developer conferences state-side. This year it attracted a decent section of the Java crowd including me (Java EE) and my fellow Oracle colleagues Jim Weaver (JavaFX) and Scott Seighman (Java SE 8). I also stopped by at the nascent Penn State University/Happy Valley JUG in State College, PA - kicking off a highly successful and well-attended very first meetup consisting of a whole day Java EE 7 hand-on workshop!

At CodeMash I delivered talks on Java EE 7 and using NoSQL with Java EE, both of which went well. More details, including the slide deck and code, posted on my personal blog.

Monday Dec 16, 2013

Java EE@Pune JUG

Pune JUG organized a meetup at the Symbiosis Institute of Computer Studies and Research (SICRSR) college campus on December 14th. Led by Harshad Oak (Java Champion and organizer of the IndicThreads conference), Pune JUG is the oldest JUG in India and boasts a vibrant developer community. This month's meetup was focused on the Java EE 7 platform and the ecosystem that is building up around it. The meeting was led by Oracle India's own Vijay Nair. Vijay is a good friend and a lead developer with Oracle's FLEXCUBE development group in India. Among many other things like evangelizing Java EE at local Java user groups and conferences, Vijay contributes heavily to the Cargo Tracker Java EE Blue Prints project in his spare time.

 The event saw an attendance of close to around 100 people with a lot of demos/code and high quality interactions with the audience. Vijay presented no less than three sessions at the meetup:

  • JavaEE.Next(): Java EE 7, 8, and Beyond - This is basically our flagship talk at the moment. The talk briefly covers the evolution of the platform, details the changes in Java EE 7 and invites developers to help shape Java EE 8. The materials for the talk is posted here.
  • Android and iOS Development with Java EE 7 - This was a fairly popular technical session at JavaOne San Francisco 2013 led by me, Ryan Cuprak and Bala Muthuvarathan. The session demonstrates how Java EE 7 acts as an excellent platform for building "headless" back-ends for native mobile applications with REST and WebSocket as the client communication protocols. The materials for the talk is posted here. The code is posted on GitHub.
  • Using NoSQL with JPA, EclipseLink and Java EE - This session explores the current state of the NoSQL landscape and how Java EE can be utilized to access NoSQL solutions such as Oracle NoSQL, MongoDB, Cassandra, etc utilizing JPA style facades or plain CDI. The materials for the talk is posted here. The code is posted on GitHub.

Overall, this was a very positive experience with developers giving two thumbs way up to the Java EE 7 platform!