Last month in JDJ (Vol. 6, issue 4) I introduced the topic of object/relational mapping. Databases such as Oracle8i or DB2 store data in tables and columns. Thus, customer data is stored in a "customer" table and information relevant to the customer such as ID, name, and address are stored as 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." Con-ceptually, the mapping process is a simple one. Each database table is an EJB class (CMP or BMP), and each and every column in the table becomes an attribute. Individual customer records are instantiated as EJB objects as necessary.
This month I tested the latest release of THOUGHT Inc.'s CocoBase Enterprise O/R mapping tool on my Windows 2000 server. Java-centric software companies such as THOUGHT Inc. take full advantage of both Java and the Internet when it comes to software development. They continually enhance their products with new features and bug fixes.
Last month I previewed "Service Release 8," and this month I was able to upgrade to "Service Release 9" - which included more than a dozen feature enhancements. The installation of CocoBase is packaged as a Java class file; it's a simple process to extract the installation files and install the software. The Java installer isn't fully Windows 2000 compatible yet, so CocoBase doesn't create desktop icons or menu items - all the software must be accessed via a series of command scripts. Nevertheless, it's a simple process to create your own desktop icons that point to the most common functions. The starting point for working with CocoBase is the Enterprise Administration Interface. THOUGHT Inc.'s choice of terminology here is a little off the mark as the admin interface is really the heart of CocoBase. All the major functions of the software are accessible from within this one interface - which is itself a Swing-based GUI program (see Figure 1).
CocoBase can connect to any of your enterprise data through a powerful JDBC interface. The software also comes equipped with a built-in SimpleText, Hypersonic SQL, In-stantDB, database, and you can use this data source to get accustomed to the many tools within the CocoAdmin interface. I elected to work with the SimpleText database and to create a new database map (as shown in the upper window in Figure 1).
You're free to map multiple CocoBase objects to a single database table, and I quickly created a variation on the Employee Table that would list only those employees that make over $20,000 annually. I called this new object EmployeeGT20000 and generated a new data map for this object from within CocoBase within a few minutes. I chose to build this object based on a CocoBase-supplied "where clause" against the salary field using a variable for the salary. Technically speaking, this object could be used to represent any group of employees by supplying different values for this parameter. This new object extends the Object class and either doesn't implement any proprietary interfaces or implements a number of interfaces including Cloneable, CBProp (a CocoBase class), and java.io.Serializable.






