Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB2 CMP - It works in theory

 
Scott Selikoff
author
Saloon Keeper
Posts: 4015
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recently wrote an article about the fall of EJB2 CMP and was wondering if anyone wanted to discuss the issue here. It's not so much that I want to kick EJB2 CMP while its down, but learn what about it failed in the early planning and what steps or improvements could have been made to prevent such failures in the real world.
[ August 24, 2008: Message edited by: Scott Selikoff ]
 
Mandar Khire
Ranch Hand
Posts: 569
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for giving such delightful CMP failures, i am learning CMP right now so i cant discuss directly. But i sure it help me improve knowledge!
I have 1 question, BMP is quit lengthy & CMP is much simple to create, but CMP also have drawback/limitations or failure as you write!
Then what we should use for better performance/quality? Or for small programs/projects it works properly?
I learn CMP from Netbeans, Is any other container where we can write Entity beans CMP?
 
Scott Selikoff
author
Saloon Keeper
Posts: 4015
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tend to avoid BMP all together since its not really a EJB in my honest opinion. If you're going to go the road of BMP, I'd prefer to just do the whole thing in JDBC. There's really no reason to prefer BMP over CMP for EJBs unless, perhaps, for caching mechanism like if you have table key generator.

As for CMP versus JDBC in EJB2... You'll never get better performance than JDBC for a lot of commands, although CMP can be built with an entity manager that caches objects. These days I leaned toward Hibernate or EJB3/JPA, although there's still something to be said for power of JDBC. One of the best solutions I've seen to date was code generation tool that built POJOs with JDBC update/insert/delete out of hand-made XML files. Got the organization of XML, but the performance of JDBC.
[ August 24, 2008: Message edited by: Scott Selikoff ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34671
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mandar,
You should also note that BMP doesn't have a migration path into EJB 3/JPA so new code should not be written in BMP. It would be instant legacy code.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4015
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
Mandar,
You should also note that BMP doesn't have a migration path into EJB 3/JPA so new code should not be written in BMP. It would be instant legacy code.


Are you saying there's a really a migration path for CMP, though? I know some EJB3 servers will backwards support CMP, but from my experience its been in a limited (often poor performance) capacity. To get to JPA, you have to rewrite them anyway.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34671
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Scott Selikoff:
Are you saying there's a really a migration path for CMP, though?

Well, it's a horrible migration path. I probably should have used the term "series of manual steps."

Originally posted by Scott Selikoff:
To get to JPA, you have to rewrite them anyway.

I agree completely.

I was thinking of the following quote from "EJB 3 in Action" when I said this.
However, there are some inherent issues with BMP, such as N+1 problems. Unfortunately, there is no clear migration path for BMP entity beans to EJB 3. This translates into what seems like a dead end for BMP entity beans. As EJB 3 requires support for EJB 2, BMP entity beans will be supported in EJB 3 containers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic