Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tutorial that covers EJB CMP/CMR and EJB-QL

Rick Hightower
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Enterprise JavaBeans (EJB) 2.0 extends the earlier version 1.1 by adding advanced support for EntityBeans..."
"Once you get the hang of CMP/CMR, it is faster to write EntityBeans using this technology, than using low-level JDBC inside of bean-managed persistence (BMP) beans . "
" do not have to write low-level JDBC calls, and you do not have to write code to manage relationships. It is all built into the EJB framework. Your interface to relationships is through the pervasive java.util.Collection and java.util.Set which most EJB developers are already familiar with."
"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 EntityBeans. 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 EntityBean. 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 demonstrates 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 relationships 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." ion.nsf/webservices-onlinecourse-bytitle/B6C04F7C5DB8A7ED86256B65004AD53E?OpenDocument

If you like this free tutorial on IBM developerWorks. Perhaps you will like my new book
Java Tools for Extreme Programming
--Rick Hightower
[ March 13, 2002: Message edited by: Rick Hightower ]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic