Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

CMP or BMP  RSS feed

 
basanta dwibedy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am having a scenario where i need to implement a entity bean.
But i need to connect to more than one table. So please suggest which one is best and why? Whether CMP or BMP

Thanks in Advance

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't use entity beans at all. Is there a reason why you have to use entity beans? Could you not just use a JPA implementation?
[ July 30, 2008: Message edited by: Paul Sturrock ]
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you know about Enterprise Java Beans? Do you understand the differences between CMP and BMP? This information will help determine which one is best for you.
[ July 30, 2008: Message edited by: James Clark ]
 
basanta dwibedy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not satisfied with both the answer. If you don,t know the answer please don,t create any puzzle.

I am waiting for a Good Reply

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Entity beans are a legacy technology. They were poorly designed, and as such were not a particularaly good choice for a persistance layer. Amoung their problems were:
  • they needed a container.
  • you could only access them from another EJB, so you needed session beans (and DTOs etc).
  • they carried a lot of unneccessary baggage. Why does your persistence layer need all the declarative capabilities of a session bean, when they can only be accessed from a session bean?
  • performance wise they were not a good fit for large result sets
  • EJB QL was a poor subset of SQL. You almost always found a situation where you knew what you wanted to do in SQL, but couldn't get the same behaviour from an EJB.
  • they sufferedfrom the n+1 problem.
  • despite claims to the contrary they were never truely portable. They always needed a good amount of server specific configuration.


  • So which is better? CMP or BMP? Its like asking would you rather be punched in the head or in the stomach. Neither is particularaly appealing.

    All that aside, if you are absolutely determined to use Entity Beans CMP is probably the better choice. To my mind lots of development effort goes into implementing CMP so its a little presumptious to assume I could do any better on my own. However as James has already said, you know your applicaiton better than us, so you are in the best position to decide.
    [ July 31, 2008: Message edited by: Paul Sturrock ]
     
    Quang Pham
    Ranch Hand
    Posts: 47
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Paul
    I am currently studying HF EJB and this is one of my questions. You have given us a very clear answer.
    Thank you.
     
    Scott Selikoff
    author
    Bartender
    Posts: 4093
    21
    Eclipse IDE Flex Google Web Toolkit
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by basanta dwibedy:
    I am not satisfied with both the answer. If you don,t know the answer please don,t create any puzzle.

    I am waiting for a Good Reply


    We're waiting for a Good Question. To be frank, your question sounds like a homework one to me and we have a policy on the JavaRanch about that. If you do have a real question, please go into more details about what your situation is and why you are having trouble deciding between the two.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!