Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

CMP vs BMP

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have a design related question.
When should one go for CMP and whn should one for BMP? Many authors suggest using CMP only with EJB2.0 but are there situations when design considerations should force us to use BMP. I know of one such situation, where in we have a legacy DB service and our vendo server provider does not support pesistence on that service. There we have to manag persistence on our own using BMP.

Are there other situations also, which demand use of BMP and CMP, even when using RDBMS which all server vendors support or any other situation?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


When should one go for CMP and whn should one for BMP? Many authors suggest using CMP only with EJB2.0


A glib answer would be: never use BMP and use CMP only in very rare occasions. I'd not use Entity Beans pre EJB2.0 full stop (no local interfaces == unnecessarily slow performance). As is said often in these forums (and more often than not by me) you might want to consider other persistance strategies than Entity Beans.
[ November 08, 2004: Message edited by: Paul Sturrock ]
 
Rahul Devgan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. Other persistence startegies that i know off:
1. JDO Implementations like Hibernate
2. Direct persistence from Session beans, if one is not too bothered about working in relational world then purely OO world.

Are these what you were refering too or you had something else in mind, please share the same.

Also, if the choice is between CMP and BMP, what should be the choice especially for complex SQLs and multi table SQLs?
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


JDO Implementations like Hibernate


Well, Hibernate is not a JDO implementation but that's the sort of thing I'd suggest. Any good ORM technology will be better than Entity Beans.

BMP is probably your only option if you want beans spaning multiple tables (thoug has I remember, there are venodor-specific CMP implementations which can handle multitable CMP - I'm not sure though, someone might shout me about that).
 
Rahul Devgan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again for correcting me there and for initiating me on a trail...
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

if you want beans spaning multiple tables



You could consider creating a view that joins multiple tables and map your entity bean to the view.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A word of warning about that approach: you may well end up forcing your entity bean to be read only - since you have to be careful how you create your view to make it an updateable view (i.e. no set operators, can't use distinct, no group aggregate functions, no group by clause, no subquery in a select list, no join queries etc.).
 
Pradeep bhatt
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Sturrock:
A word of warning about that approach: you may well end up forcing your entity bean to be read only - since you have to be careful how you create your view to make it an updateable view (i.e. no set operators, can't use distinct, no group aggregate functions, no group by clause, no subquery in a select list, no join queries etc.).



Agreed but I think it is rare case where set operators,distinct etc would be used.
 
Beauty is in the eye of the tiny ad.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic