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.
Web Apps, SPA, PWA with vanilla Java Script (ES 6+), CSS 3 and WebStandards only. As simple as possible, but not simpler. See you at: (Progressive) Web apps, Single Page Apps and WebStandards airhacks workshops at MUC airport, Winter Edition
airhacks.fm the podcast:
Stay in touch: airhacks.news.