Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News

SYS-CON.TV
Cloud Expo & Virtualization 2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts
CocoBase Enterprise
CocoBase Enterprise

One of the more complicated issues that J2EE application developers face is the process of mapping relational data to EJBs. The J2EE specification provides EJBs as the mechanism to persist objects into a database. They certainly solve lots of problems for developers, especially in the areas of transaction management and distributed computing.

EJBs come in two basic flavors: session and entity beans. Conceptually speaking, session beans are simpler to understand as they map fairly easily to logical business transactions. Entity beans provide the glue that allows a session bean to interact with the relational database tables that manage the actual data. Database tables are relational and entity beans are objects; combining these two technologies may look simple - but it's a complex process under the covers.

Fundamentally speaking, working with entity beans and a relational database is an exercise in data mapping. RDBMS engines such as Oracle store data in tables and columns. Thus customer data is stored in a "customer" table and information relevant to the customer is stored in columns. All the data for a single customer within the customer table is equivalent to a "record." From the EJB perspective, customer data is represented by a customer "class" and the data elements are represented by "attributes." Conceptually, the mapping process is a simple one. Each database table is an EJB class and each and every column in the table becomes an attribute. Individual customer records are instantiated as EJB objects as necessary. Although it sounds simple, it can be complex to implement this type of mapping.

Entity beans come in two flavors, bean-managed persistence (BMP) and component-managed persistence (CMP). If you have connected EJBs to your database, you're probably familiar with BMP entity beans. With them you connect your EJB object with a JDBC driver that works with your target database. You're responsible for writing all the SQL code so you're able to optimize your application for the target database. Many first-generation EJB applications were constructed this way. The downside to this approach is twofold. First, you're locked into a single database vendor and the process of porting between databases can be a complex task. I'd argue that the second issue, productivity, is the more serious problem. Handcrafting SQL statements for a database is a huge loss in productivity. All the leading relational databases have high-speed optimizers and fast transaction processing engines. Ideally, then, EJB developers should be able to reverse-engineer preexisting relational databases and generate the persistence layer automatically.

A solution to this problem comes in the form of dynamic data mapping. A number of third-party vendors offer highly sophisticated data mapping tools for many of the popular J2EE application servers. One company garnering a lot of press and attention in this market is San Francisco-based THOUGHT, Inc. The developers at THOUGHT, Inc., have built an enterprise-class object-to-relational mapping product called CocoBase. CocoBase is packaged as an administration utility and a code-generation layer that works with most of the leading application server engines.

CocoBase plugs into your favorite database via JDBC drivers. Once you've connected to your database, CocoBase creates both BMP and CMP beans for your relational database tables.

You're free to map multiple objects to a single database table and/or map multiple tables to a single object. For example, you might create different EJB objects to represent "good customers" and "bad customers." CocoBase generates a mapping file so you can change the mapping layer without having to modify the code or recompile the application. Developers are then free to concentrate on the business logic instead of wasting valuable programming time writing endless SQL statements. CocoBase uses a three-step process for building EJBS:

  1. Using the CocoAdmin GUI tool, the developer connects to the database and visually maps tables to objects (and vice versa).
  2. CocoAdmin generates CMP/BMP bean code for each object for the specified J2EE application server.
  3. EJBs are loaded into your EJB server and are ready to use.
Such an approach offers great potential. First and foremost, it can improve the productivity of the development team. Database access and deployment code is not rocket science, but it can require lots of programming resources. An O/R mapping solution such as CocoBase can eliminate this task from your development list and also dramatically improve overall application performance.

Since the developers at THOUGHT, Inc., concentrate all their attention on the persistence layer, they're able to optimize the performance of this portion of the application. As an individual application developer you may not have the time or resources to build optimizations in your persistence layer. CocoBase generates some sophisticated performance optimizations directly into the EJB code that's generated. For example, it uses a data caching mechanism to reduce the number of interactions between the application layer and the database. It adds this performance improvement at the application server level without significantly impacting the performance of the database itself.

It's important to keep in mind that the J2EE specification provides a road map for development, not the implementation details. Application server vendors offering products in the J2EE space will find it more difficult to incorporate best-of-breed technologies inside their server suites as the J2EE specification expands. This provides an excellent opportunity for vendors such as THOUGHT, Inc., to provide optimized solutions for specific parts of the J2EE specification. As both the specification and the vendor implementations mature, we'll begin to see the benefits of this type of plug-and-play at the application server layer. After all, this is exactly what Sun would have us believe J2EE is all about - true interoperability.

Summary
Object-to-relational mapping is a complex process and may prove to be one of the single biggest hurdles that must be overcome when building an enterprise-class EJB-based system. Sophisticated mapping tools such as CocoBase are worth considering as a solution for this problem. I'd encourage you to place O/R mapping solutions on your short list of technologies for speeding up J2EE development within your organization.

About Jim Milbery
Jim Milbery is a Vice President with William Blair Capital Partners, a venture capital firm based in Chicago. He has over 19 years of experience in application development and relational databases. He is the former applications editor for "Wireless Business and Technology", the past product reviews editor for Java Developer Journal and the author of "Making the Technical Sale". Jim can be reached at jmilbery@williamblair.com, or via the company web site at http://www.wbcapitalpartners.com

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Latest Cloud Developer Stories
Swisscom, the Swiss telecom, is going into the cloud business. Its subsidiary Swisscom IT Services AG has signed up with Red Hat as a Certified Cloud Provider and launched a public cloud Infrastructure-as-a-Service (IaaS) cloud targeting enterprise-class customers primarily in ...
Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP)....
In a surprise move on Tuesday, January 10, Oracle wheeled out its Big Data Appliance. That’s the one it said in October would be ready sometime in the first half. Only nobody believed it meant early in the first half. Heck, it’s not even clear anybody thought Oracle could make ...
Rackspace Hosting, the service leader in cloud computing, on Thursday announced its acquisition of SharePoint911, an industry leader in SharePoint consulting, training, and "JumpStart" services within SharePoint. The unification of both companies provides capabilities to deliver ...
CloudLinux, Inc., on Thursday released CafeFS 3, a virtualized file system for shared hosters that cages each customer within its own virtualized file system. CageFS becomes part of CloudLinux OS at no additional charge. CloudLinux OS, the only commercially-supported Linux OS m...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers
ADS BY GOOGLE

Breaking Cloud Computing News
As client demand for engagements increases, Revel Consulting (www.revelconsulting.com), a Kirkland, ...