geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gianny Damour <>
Subject CMP2.x - new features available - shake out phase
Date Sat, 16 Oct 2004 03:31:45 GMT

We have recently hooked in what we believe is sufficient enough to give 
a fair try to petstore1.3.1_02.

The new capabilities are (Dain, thanks for having logged these issues):
* GERONIMO-177 - Support for user defined primary key classes: nothing 
very special in here; it is now possible to specify a compound primary 
key, which may be mapped to multiple CMP fields. </jira/browse/GERONIMO-177>

* GERONIMO-179 - Support for CMRs </jira/browse/GERONIMO-179>: OTO, OTM 
and MTM container managed relationships are enabled.

* GERONIMO-176 - CMP table mapping support </jira/browse/GERONIMO-176>: 
it is the capability to map the CMP and CMR fields of an EntityBean  to 
a database. There are a couple of examples for each (primary key type, 
relationship multiplicity) couple in here:

* GERONIMO- 377 - Unknown primary key support: this is used to support 
the deployment of EntityBean having an unknown primary key class. By 
now, no test-cases have been committed. Having said that, here is an 
explanation of how to use it:

EntityBeans having an unknown primary key class, i.e. java.lang.Object, 
must declare a <automatic-key-generation> element. This latter specifies 
the name of a primary key generator along with the class type returned 
by this same generator. A primary key generator can return either simple 
or compound primary keys. In the former case, a <primkey-field> needs to 
be specified along with the <automatic-key-generation>. In the latter 
case, no <primkey-field> must be specified.

"Virtual" CMP fields are to be defined in order to store the 
auto-generated primary keys. One does via the standard 
<cmp-field-mapping> element; though, one must also declare the class 
type of such "virtual" CMP fields via the <cmp-field-class> element.

As of this writing, two primary key generators are supported:
- sequence, store procedure or more generaly any SQL statement returning 
a unique identifier: this is the GBean 
org.openejb.entity.cmp.pkgenerator.SQLPrimaryKeyGeneratorWrapper; and
- sequence table, where a sequence is simulated via a table: this is the 

Example of unknown primary key definition - to be specified in 

           <ejb-name>ProfileEJB</ejb-name>   // ProfileEJB has an 
unknown primary key as per ejb-jar.xml.
                   <cmp-field-name>id</cmp-field-name>   // id is not 
defined in ejb-jar.xml; this is a "virtual" CMP field.
// one must specify the class type "virtual" CMP fields.
              <primkey-field>id</primkey-field>  // defines the 
"virtual" CMP field storing the auto-generated identity.

// reference a primary key generators

    // this is the declaration of the primary key generator used by 
    <attribute name="tableName" 
    <attribute name="sequenceName" 
    <attribute name="batchSize" type="int">10</attribute>

For sure, there are some bugs and it will take a couple of weeks to 
identify and fix them. So, if you want to trial these new features with 
your home-grown CMP2.x EntityBean and help in this shake out process, 
then that would be awesome.


View raw message