Domain Driven Design, EJB 3, JPA, Glassfish v2, JSF (Model View Presenter), Data Binding, Java DB ...or sports for Java Hackers
I posted already about Fluent Interfaces, EJB 3 and JPA. With Java EE 5 it is absolutely possible to build applications, which look DSL-like with JPA 1 and EJB 3:
You can use "known" patterns and approaches for this purpose like Builders and static inner classes. In the sample above a Stateful Session Bean with Extended PersistenceContext and a bunch of JPA-Entities is used. However I was often asked about the integration of "such" code into a real world applications - so I build a complete sample and integrated the JPA entites using Model View Presenter (actually Passive View and Supervising Controller) to a JSF application. I would like to build a Swing/JavaFX frontend as well.
It is an application which manages your training data (in case you are a runner or biker). The main Use Cases are the computation of the average pulse, speed and the corelation between both etc. (and everything else which is interesting for a Java developer). This application was built with Netbeans 6.0 out-of the-box and it runs on Glassfish V2, Apache Web Server, Java DB and 64bit Linux. The URL is http://www.adam-bien.com/tdb/. The whole source code is available in http://p4j5.dev.java.net (already 35 registered observers and 2 committers)- the project name (EAR-project) is RunAndBikeApplication. I will disect this application in the upcoming editions of JavaSpektrum in greater detail as well.
I'm the first registered user - and use it already. If you like use it and improve it. I would like to provide some top-score ranking system as well. However, I would like to remain under the first three places, and will fine tune the results :-).
I introduced the application at yesterdays NUG/JUG meeting in Munich (really great event) and got already some requests for enhancements (like covering swimming for triathlon). One particant ran marathon and 2:58 (it is comparable with lightening speed :-)) and will use it as well (he will get a VIP status). A committer "dynamic" contributed already some code ...and ran the marathon in 3:17 (unreachable too).
The NUG meeting was great. I hacked and deployed a small application with Stateless Session Bean, Web Services, interceptors, JPA entity with inheritance, relations etc. There were many questions and many t-shirts. Because of lack of time (it was really open-ended - I went home at 12PM :-)) - there will be a second part: I will talk about the Presentation Tier, Java FX, GWT, JSF, or other cool stuff in summer. The munich's NUG/JUG community is really great, I enjoyed the private talks afterwards. Special thanks to Anton Epple (the NUG/JUG) leader for the great organization, and Sun Microsystems - for the T-Shirts, Java Spektrum for the free magazines...
Btw. I will cover this example during the Developer Days (Entwickler Tage) in Frankfurt (27.02 - 29.02.2008) as well.
die training-DB ist ja mal cool. Ich werd mal 'comitten' :) Aber Puls messen ist echt was für Sonntagsläufer und Stock-Uschies ;)
Posted by Sascha on February 02, 2008 at 08:57 PM CET #
my actual motivation was to corelate the average pulse with the average speed. So gathering the average speed in TDB is the "essential" Use Case.
...you will get only commit-rights, in case you will manage your average pulse :-).
Btw. your average speed is remarkable...
Posted by Adam Bien on February 05, 2008 at 03:59 PM CET #
I'm having a difficult time finding discussions / information on DDD (Domain Driven Design) in the JEE world. You're one of the few people I've seen mention this approach (rich domain / JPA objects). Could you please recommend any god resources you know of for applying DDD using EJB3/JPA etc.? The traditional JEE patterns seem to suggest dumb persistence objects, not rich.
Posted by Rich Taylor on August 12, 2008 at 10:33 PM CEST #
Yes, I have the same feeling of Rich Taylor. I am interested in your comments which listed SOA(procedural) and DDD(oo) side by side.
I also notice that the agile advocators (in china) seldom metion the SOA and the SOA advocators talk little about domain-driven too.
All above suggested the result that it's a challenge to combine the two things.
is the service-oriented approach another myth ?
The nature of procedural approach will be proved to be inefficient for describing the complexity of the enterprise application.
hope to see the relative content in your blog:)
Posted by Joseph Tseng on November 11, 2008 at 06:33 PM CET #