• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

BMP Vs CMP

 
Ranch Hand
Posts: 1491
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Performane wise which is better BMP / CMP ??
 
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
Both are bad.

BMP of course requires you to write the actual persistance code, so it could be better, or it could be worse. Who knows. Depends how you write it.
 
kri shan
Ranch Hand
Posts: 1491
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Paul, out of these two which is better?
CMP supports DB portability. BMP supports Application Server portability.
 
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


HI Paul, out of these two which is better?



This is a unhelpful answer I know, but I'd say neither. Both are bad.

Any answer to your question will be very subjective - there are situations where one might be better than the other and viceversa.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kri,
Why are BMP and CMP the only two options. If CMP does not perform acceptably, you have to write code yourself. Then you are better off using some other persistance mechanism behind a session facade.
 
kri shan
Ranch Hand
Posts: 1491
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne, instead of re-inventing the wheel, i would like to use existence persistence mechnaism
 
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
Then why not use an persistance mechanism other than Entity Beans? Hibernate, Toplink, OJB, JDO etc. are all better than Entity Beans.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by kri shan:
Hi Jeanne, instead of re-inventing the wheel, i would like to use existence persistence mechnaism


I agree completely. Note that while BMP provides a persistance framework, you still end up writing most of the code yourself. I think it is really between CMP and one of the technologies Paul listed.


CMP supports DB portability. BMP supports Application Server portability.


This implies that CMP is not portable across app servers. You have to regenerate the deployed code, but it isn't inheritently unportable. That said, I would go with Hibernate if I was starting a new project, could choose and didn't need the security/transaction/scalability support of CMPs.
 
kri shan
Ranch Hand
Posts: 1491
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whether Hibernate, Toplink, OJB, JDO provides all EJB container provided services(Security,Tranasaction,..) other than Persistence?
 
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
No. But why would you need them in a persitance layer?
 
kri shan
Ranch Hand
Posts: 1491
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i use Hibernate, Toplink, OJB, JDO, i have to use EJB container provided services / i have to write the code for Tr,Security... Hence one more extra layer/tier comes here ( Tr Layer + Persistence Layer). Whether is it a good design ?
This is my doubt.
 
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
No. You just call your persistance layer methods from an EJB.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its seems to a lot of ppl are confused and seem to think that BMP means EJB + handwritten SQLs. It does not.

BMP just means EJB + manual persistence, whether i handwrite the SQL or use an OR Mapping tool (hibernate, ibatis, custom made, etc). If you use hibernate from your EJB, then you still get CMT provided by the app server plus the nifty OR Map provided by hibernate, so its a win win.

Here's where we typically apply the DAO pattern. So if one day you feel like switching from hibernate to handwritten SQLs or some other OR solution, just implement a new DAO to wrap that and plug it in. Your EJBs working on the DAO interface wont even know you switched implementation and the container could care less, it calls your EJBs with whatever txn attribute you declared and commit/rollback/resume/etc the txn after your ejb method completes.

Cheers.
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Infact what is suggested is you can use the persistence layer of Hibernate and call those methods from a Stateless Session bean and there you can put your transaction attributes also.

Cheers,
Rahul
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic