HFEJB versus "J2EE Design Patterns" on Data Access Patterns
posted 12 years ago
Hi! I've just started my research in J2EE on the Business Objects side of things. So far I've only read Head First EJB and am currently reading "J2EE Design Patterns" (both O'Reilly) However, I've come across some conflicting advice with regard to data access patterns and would like some peoples opinions. In the Head First EJB Book which is based on EJB2.0. They state that in EJB1.1 and even in the pre-released version of EJB2.0 CMP was inefficient clunky etc. However they clearly say that due to fact that CMP2.0 is "light years ahead" that "there is little reason to ever use BMP". Now in the J2EE Design patterns Book they heavily cover Data Access Patterns and pretty much indicate that for various reasons you would use BMP. I didn't get the feel that they were saying that .... if things get out of hand use these patterns but more like things will get out of hand if you use CMP. So I check the dates to see if the patterns book was written after EJB2.0 and it was (from my understanding). So what do people here think ? I can see the issues about reducing the number of Entity beans. However I thought that if I kept to a limited set of EBs either the continer would merge multiple field request into one or database caching would solve a lot of the performance issues. If you were going to write a sizeable enterprise application and you are familiar EJB2.0 would you use these patterns or CMP2.0 ? It should also be mentioned that it's a big pity that HFEJB didn't include the chapter "Performance and Patterns" which is referenced in the book. eg you will see phrases like ... We will cover that later in the P & P chapter. Maybe there's a hidden key I need to find or maybe it was left on the editing floor but there is a soft copy on the web Hmmmmm ?