JavaOne 2011: Java EE 6 - The Cool Parts: Code And Video

The session was repeated (because of AttendeesOverflowException), so I developed the sample application twice.

The first application (on the video) is CoolPartsOne
The second application (from the repeated session) is (surprisingly) CoolPartsTwo

I mainly responded to attendees questions what ended in two different applications.

Thanks for attending my JavaOne 2011 sessions and for the attendees overflow!


The video doesn't seem to be working. Tried on IE, Chrome, Opera.

All I see is a static image with ", The Next-Gen eLearning Platform".

Posted by Vladimir Sizikov on October 10, 2011 at 03:07 PM CEST #

same here - the video isn't working

Posted by noa on October 10, 2011 at 04:50 PM CEST #

Hi Adam,

First of all thanks for such nice sessions. I happen to attend both of them and they turned out to be one of the best I attended in whole JavaOne.

This was my first encounter with EJB after moving on to Spring in 2004.I have quite a few related questions and will appreciate your insight on those:

1- The first question is related to the code example from the session. You mentioned that for Asynchronous processing of Events (i.e. Observers part) we can use the EJB 3.1 @Asynchronous annotation and the listener will then execute in a separate thread. The asynchronous execution can return either void or an instant of Future. If we return Future, then how can we access the results from event (i.e. future.get())? The signature of returns void. Do we need to inject the listener directly in this case and call the method our-self? If yes, then it does not remain observer pattern any more.

2- To develop enterprise applications with EJB 3.1, do you recommend using a framework such as JBoss SEAM? or do we have enough abstractions (like Security, Remoting, JMS etc) available in bare bone EJB 3.1.

3- My last question is about presentation tier technologies, do you recommend any particular web presentation framework (like GWT, JSF etc) that plays nicely with EJB 3.1 on back end.

Looking forward for your reply.


Posted by Shoaib Akhtar on October 10, 2011 at 09:08 PM CEST #

Hi Shoaib,

I'm glad you liked my sessions!

1. @Asynchronous with Future does not make any sense. It was just an example. However: @Asynchronous with Future is really useful for batch-job processing but not for events.

2. I would start with vanilla Java EE 6 + JSF 2 (or Java FX 2 - becomes more and more interesting) and use Seam 3 as collection of utilities on demand. I would not start with Seam 3 from scratch.

3. I would start with JSF 2 and implement a PoC with stress test. For most cases it is the most straight forward choice.

thanks for your comment!,


Posted by Adam Bien on October 11, 2011 at 05:41 PM CEST #

Thanks adam for the reply.

I have couple of follow up questions:

1- Your are absolutely right that events with Async results does not make sense. So in case we need asynchronous behavior with results, we have to inject the EJB directly in our code and call the method ourself. Correct?

2- My other question is about JSF 2. So far, I have not heard many success stories of people using JSF 2. And our application requires very rich interface l (It is currently in Swing) and we considered using either Adobe Flex or GWT for a future upgrade. The later seems to be a good choice as it can also run on mobile devices.
We have been hearing about Java FX for a long time now but it has not got a lot of traction lately and seems be more targeted towards animations. I would like to get your opinion about rich interface development (without Swing).


Posted by Shoaib Akhtar on October 11, 2011 at 07:40 PM CEST #


I would go with Java FX 2 - it is Swing compatible and really promising. If your application consists of many views and parts, I would consider to use NetBeans RCP. It is Swing and Java FX 2 compatible.

I would use in my next project Java FX 2 as well. Java FX 2 will become a part of the JDK - so it is an obvious choice.



Posted by Adam Bien on October 11, 2011 at 10:44 PM CEST #

Thanks adam for your prompt replies and suggestions. I will certainly try to do PoC on this technology stack and I hope to convince the 'aliens' :)


Posted by Shoaib Akhtar on October 11, 2011 at 11:18 PM CEST #

Me again :).
Just want to check with you that what is your take on using DTO (Data Transfer Objects) pattern in rich interface based application.

We have been using our domain object as domain transfer objects but they have deep graph that results in too much data being transferred back in forth between client and server. So I am thinking to use DTO to cut the serialization cost as well as display only the relevant information.


Posted by Shoaib Akhtar on October 12, 2011 at 10:19 PM CEST #

Hi Adam,

nice info that Java FX will be part of JDK - this makes a lot of sense and will probably push this technology.

And just saw that it is available for the Mac now :-)

Will give it a try as UI frameworks are still a mess in my point of view. I don't like JSF and also GWT has a lot of pain points - we are using Vaadin in our projects which is good but still not perfect. Maybe Java FX will be a step into the right direction.


Posted by Mirko Novakovic on October 13, 2011 at 12:28 AM CEST #


just go with pure JPA-entities and REST. You will have to serialize them over XML. Usually you can reuse JPA-entities for the serialization. In exceptional cases you can rely on DTOs...

Enjoy deleting code! :-)


Posted by Adam Bien on October 13, 2011 at 01:32 AM CEST #


"... I don't like JSF..."

This is a dangerous attitude. Ask an Alien about that for a verification.

But I also really like Java FX 2 - and it is hard for me to remain objective in this case.

Now my objective opinion: Java FX 2 is beyond interesting :-)

thanks for your comment!,


Posted by Adam Bien on October 13, 2011 at 01:34 AM CEST #

Very nice presentation. Thanks for sharing. JavaEE 6 is very powerful yet simple. With all these features that JavaEE 6 offer, do you use Spring or Struts or Hibernate in your projects?

Posted by Leandro on October 17, 2011 at 08:43 AM CEST #


thanks - I'm glad you like it. I'm using Java EE 6 in the vast majority of my projects. ...and I'm still deleting superfluous code and external dependencies.

Java EE 6 is very capable out-of-the-box but you can "extend" it with whatever framework you like. Until now the power of Java EE 6 is more than sufficient for my (=my customers) needs.

thanks for the nice comment!,


Posted by Adam Bien on October 18, 2011 at 04:58 PM CEST #

As for the sub discussion of JSF 2 vs Java FX 2; these are normally not really direct replacements for each other. Just as Qt is no replacement for PHP, SWT is no replacement for RoR, etc.

Java FX in particular is a pure client-side technology. It's not server aware. But just as you can build Swing applications that contact some server to get data (e.g. via JAX-RS), you can of course use Java FX for that. You have to be aware then that you are programming in a different kind of paradigm.

This discussion is related to how HTML5 should be supported by the server-side frameworks. Ed Burns recently blogged about this:

Here's one example of combining the two for JavaFX:

and one for HTML5:

Posted by Robert Tuinman on October 19, 2011 at 10:20 PM CEST #

Great talk!

My favourite: "OSGi is greate... if you dont use it its even better..."

Thx! Jan

Posted by Jan Wiemer on October 23, 2011 at 07:01 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments