advantages and disadvantages of CMP and BMP

Discussions

EJB programming & troubleshooting: advantages and disadvantages of CMP and BMP

  1. advantages and disadvantages of CMP and BMP (7 messages)

    I wanted to know what the advantages and disadvantages of using a BMP over a CMP......

    Can anyone help???
  2. BMP = more flexible
    CMP = much less implementation effort

    Read a book!

    Daniel.
  3. Guys, it's time to read Ed's book, 2nd Ed.
  4. and usually retrieving data (findBy... methods) from CMP is more efficient using CMP (less DB Access)
  5. Less DB access means nothing. You'll still need to have optimized SQL statements (especially, for large queries) - the container will never create an optimal execution plan for your specific database.

    Alex.
  6. And another disadvantage of CMP - you'll have much more sex seeking bugs while using CMP.

    Alex.
  7. I have struggled with the choice between CMP and BMP. I have almost always ended up using BMP unless it's very simple app. In some cases, I have started with CMP and then switched to BMP as the app got more complex and I felt the need to hand optimize the queries. I wonder if others had similar experiences. Another issue I have with CMP is that you get tied to specific vendor's CMP engine.

    For database independence, I don't have any SQL query embedded in my code.I have them in properties file. Each query is referred by a name.

    Pranab
  8. In my first EJB project back in the days of Weblogic 4.5.1 we used CMP to store the basic objects and SSB with SQL to do complex data retrieval. That pattern still seems to work well.

    One system I recently designed we used BMP to implement the Composite Entity Pattern. This worked very well and the pattern held good.

    My current project is a bit of CMP2.0 with BMP/SQL thrown into the mix. CMP2.0 is a lot better but it is still lacking in so many areas.