I even checked-in a sample for the Persistent Domain Object pattern to the p4j5 repository. The sample is a small, but objectoriented, shoppingcart which can be even started outside the application server/container. There is nothing special the implementation, except it has methods with some logic and only few getters/setters (because they are not needed). A Persistent Domain Object (PDO) is just an object, but is persistent. The reaction of a such objectoriented approach and simplification (actually the activitiy layer and the persistence are collapsed) can be interesting (about 30 comments for my post about "evil" getters and setters). I presented last week this pattern in the Java EE 5 Workshop at oose.de as well. A Java EE beginner ask me: "Actually, you are talking 2 hours about object oriented design - the one and only difference are few strange annotations - so why you are so excited?". Interestingly enough the other more seasoned developers were shocked. They were used to seperate the business logic from the persistence :-).
Java EE 5 brings us a paradigm shift. Dumb persistent objects (Persistent Anemic Objects) should be an exceptional best practice and not the common rule. Also Getters and Setters are optional - complex business logic can be only hardly emphasized with accessors...
Cloudy Jakarta EE and MicroProfile: Microservices, Clouds and Beyond Jakarta EE / MicroProfile airhacks workshops at MUC airport, Winter Edition
airhacks.fm the podcast:
Stay in touch: airhacks.news.