File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes EJB2 CMP - It works in theory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB2 CMP - It works in theory" Watch "EJB2 CMP - It works in theory" New topic
Author

EJB2 CMP - It works in theory

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

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 ]

My Blog: Down Home Country Coding with Scott Selikoff
Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 485
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?


Millions saw the apple fall, but Newton asked why.
If you understand, say "understand". If you don't understand, say "don't understand". But if you understand and say "don't understand". How do I understand that you understand? Understand!
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29245
    
139

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29245
    
139

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: EJB2 CMP - It works in theory
 
Similar Threads
Two phase transaction with WAS5.0?
what is the equivalent of BMP and CMP in EJB3?
Difference between EJB2 and EJB3?
Is there good EJB3 book?
Jboss 4.2GA distributed environment