ibm.com/developerWorks
Presented by developerWorks, your source for great tutorials
Instead of writing a giant tutorial that would take days to go through. I have split the
tutorial into three parts that can each be finished in an hour or so. You could finish each
tutorial during a lunch break, so get a sandwich and a beverage, and get started.
EJB 2.0 added a lot of features and functionality, this tutorial focuses on CMP/CMR.
Thus, this tutorial assumes you have a background with EJB, and entity beans. You
don t have to be an EJB expert to follow along. The tutorials cover local interfaces,
deployment descriptor CMP, CMR fields and relationship elements. I will also cover the
full range of relationship types as follows:
One to one
One to many
Many to many
The relationships in the example also cover both unidirectional support and
bidirectional support. The relationships are defined in XML deployment descriptors.
In the first tutorial, you get a taste of CMP/CMR and EJB QL, then I will delve into an
example of a simple EJB 2.0 style CMP entity bean. Part of the example demonstrates
simple EJB QL to create a finder method without a Java implementation. This tutorial is
just to get you acclimated to the terminology and technology. and it adds a teaser
example. The next part, the second tutorial, does the heavy lifting.
In the second tutorial, I will build on the first example to eventually cover each type of
relationship and each type of direction (both unidirectional and bidirectional form). Each
example also has a client that demonstrate accessing the relationships to add, remove
and change related members. Lastly, cascade delete is demonstrated with
consequences for both the one to one relationship example and the one to many
relationship.
In the third tutorial, I will demonstrate advance EJB QL to build finder and select
methods. This tutorial uses the relatioships I built in the last tutorial to show the ends
and outs of EJB QL.
Each example includes source code as follows: Deployment Descriptor,
Implementation class files, Interface class files, Home Interface class files and an Ant
build script. For these examples I will use the J2EE reference implementation which
ships with Cloudscape RDBMS system.
In a future follow on article to these tutorials I will port the final example to IBM
Websphere plus DB2 and JBOSS plus HypersonicSQL to show how the CMP 2.0
entity beans can be deployed to many environments: from light weight single user
databases to industrial strength transaction servers utilizing full scalable behemoth
databases! This article will disucss some of the pitfalls of CMP 2.0 implementation
variants.
Now that I have stated what the tutorial will cover, let s briefly go over what I m not
going to cover. I will not cover (in any detail) support for transactions, as this is not new
Page 4 of 48
Introducing EJB CMP/CMR, Part 1 of 2






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

tomcat web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved