EJB 3, JPA, JSF and Patterns - sample application online - already 75 registered users

The  (Training Data Base, or "Run And Bike") is an application which manages your training data (sports, not Java trainings :-)). The essential use case is the corelation between the average running/biking speed and your average pulse. I started with sports and was just curious about my progress. Because of lack of time I used Netbeans 6.0 with visual JSF and Glassfish v2 with Java DB. The first version was fully functional, but I wasn't really satisfied with the maintainability and quality of code. Especially the separation between the generated and implemented code was not good enough. I rewrote the whole application during a weekend using the Domain Driven approach (or just objectorientation) and some presentation view patterns like ("Passive View"/"Supervising Controller").

The API to the JPA entities and Session Beans looks like (an excerpt from a Unit Test):


Only in few days (actually in three) about 75 new users registered. I got even one contributor/committer. The Training Data Base is a part of the "Patterns For Java EE 5" java.net project (built with Netbeans 5.5/6 and tested with Glassfish v2). The whole sourcecode is maintained in the Subversion repository, I install the bits from time to time on my Glassfish v2 server (in general once a week - it's always beta :-)). E.g. this week I implemented RSS feeds with most eager runners. The goal of the project should is fun + an opportunity to try out interesting things. I will provide a charting component in the next time, and excel (or openoffice of course :-)) export as well.

The whole architecture will be explained in detail in the upcoming JavaSpektrum issues (German Java Magazine). The first part will concentrate on the presentation, the second more on the business tier... I will explain the whole application in great detail during the "Entwicklertage" workshop as well.


Hej Adam,

i finally managed to get access to your run and bike db web application. After a sucessfull registration and some navigation tests i checked out the 3 projects from subversion. I do like the technical architecture behind this web app, hower i dont like the performance. Creating a new user or new training units takes imo too much time ...
It would be interesting to see if the same web app would be faster if you only developed a web-project using JSF, Derby and TomCat as Webserver.

Greetings from Stuttgart

Posted by daniel on February 07, 2008 at 11:36 AM CET #

Hi Daniel,

thanks for the review. The problem is not the architecture, the problem is the connection :-). It is really slow (I noticed it in a hotel). However, local access is lightening fast - so it works perfect for me :-). Just try it locally - it should not be a huge problem,



Posted by Adam Bien on February 07, 2008 at 06:27 PM CET #

On what kind of hardware/software does this ear run?
I am actually developing a similar web app...and i dont want my clients to install and run a glassfish app server ;) tzzz

Posted by daniel on February 07, 2008 at 08:38 PM CET #

It runs on Glassfish v2. Why not glassfish? It is easy to install, very easy to manage (nice ui) and has small footprint. By the way: I measured the overhead of EJB 3. It is almost not existent :-) (I will publish the result in my next post). If you like to improve performance, you should replace JSF with Plain Old JavaServerPages :-). However from the maintenance perspective it is not a great idea. However with a fast connection RunAndBike is really fast (less than a second for an average use case...)

Posted by Adam Bien on February 07, 2008 at 09:04 PM CET #

Hej Adam, thanks for answering... it s not about glassfish...i am thinking if i am in need of an ejb container? if you look at the example here:
There you create a simple crud web app without any ejb container...

Posted by daniel on February 07, 2008 at 11:44 PM CET #

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