• Post Reply Bookmark Topic Watch Topic
  • New Topic

What's wrong with EJB CMP ?

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I came across this statement on the web, attacking EJB persistent framework.
CMP Entity Beans is an example of a technology that makes refactoring expensive. Without proper support for fine-granularity collections and dependent objects, you are forced to choose between course-granularity CMP beans and hand-coded JDBC. Neither solution is well adapted to rapid change. The first solution limits code re-use. Patterns supporting the second solution (like DAO) encourage the growth of parallel class hierarchies.

Can someone explain to a EJB newbie why EJB is hard to refactor ?
Thanks
Pho
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you obviously can't reuse the JDBC code from a CMP, because there isn't any.
But that's the whole point of CMP - it's one less collection of code that's locked into some particular vendor's brand of database (il)logic.
So from that point of view, I'm not sure I'd care. Personally, I can't think of any case where refactoring into a jdbc-based alternative to CMP is going to more difficult, since you're going to have less surprises in situations where you add or remove code as a unit than where you have to go in and transmute code.
 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim for your comments.
Obviously portability is a big plus with CMP.
But it's idealistic.
Sometimes we want absolute control on the SQL code and I may *WANT* to write nonportable SQL to take advantage of the database.
Frankly I'm trying very hard to convince myself that EJB CMP (and EJB in general) is a worthwhile investment. I have heard & read so much bad things about EJB that it's scaring me off.
See EJB Damnations
and
Rikard's answer to the question - IS EJB LEGACY ?
Pho
[ September 30, 2002: Message edited by: Pho Tek ]
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're correct. Sometimes you need SQL features that CMP won't let you get at.
For that, there's BMP.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!