Fluent Interface Pattern with EJB 3 and JPA - a working sample

The Fluent Interface Pattern is nothing else, but the revival of object oriented development. However if you mention "object orientation", you will get an answer "It's nothing new" and still see Getter/Setter programming style and anemic objects (actually structures) :-). However with Java EE 5 it is possible again to build object oriented systems internally and expose them as services to the outside world. Building good, fluent APIs requires you to understand the domain. So it is really hard to provide reasonable samples for "Fluent Interfaces".

The following example is a snippet of a standalone JUnit-Test in the RunAndBikeDB sample project in p4j5:

    public void addNewTraining(){
            String userName = this.existingUser.getUserName();
            String password = this.existingUser.getPassword();

You should understand the highlighted snippet, without having deep knowledge in Java EE 5 or even Java. What you do not see, are several JPA entities and a EJB 3 working behind the scenes for you. I'm working now on JSF and Swing frontend - using the MVP (rather Passive View) Pattern - this integration will be explained in the next JavaSpektrum (February) magazine (and this blog) more deeply. I will explain this pattern at the free Java User Group / Netbeans at at 24.01.2007 in Munich as well. The whole, deployable project is available freely from p4j5 (svn).

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.


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