geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Geronimo Wiki] Update of "Working with Enterprise JavaBeans" by JacekLaskowski
Date Sat, 09 Jul 2005 00:09:26 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Geronimo Wiki" for change notification.

The following page has been changed by JacekLaskowski:
http://wiki.apache.org/geronimo/Working_with_Enterprise_JavaBeans

The comment on the change is:
Minor editorial changes

------------------------------------------------------------------------------
  
  = About =
  
+ This page describes the OpenEJB-specific configurations required to deploy EJB onto Geronimo.
- This page presents from a user perspective the OpenEJB specific configurations required
to get EJB up and 
- running within Geronimo.
  
  = CMP Entity Beans =
  
  This section assumes that you:
-   * know how to deploy a JDBC data source in Geronimo; and
-   * know what is a GBean.
+ 
+  * know how to deploy a JDBC data source in Geronimo - see [http://wiki.apache.org/geronimo/Deployment#head-21336a0a66d1920932fb37038c3a558f332948bd
Database configuration]
+  * know what is a GBean - see [http://wiki.apache.org/geronimo/FrequentlyAskedQuestions#head-c831847749b8a4938088b431ee53c0def26d6c0a
What on Earth is a GBean? Why are they different from MBeans?]
+  * are familiar with the deployment configuration schema - see openejb\modules\openejb-builder\src\schema
in the OpenEJB repository
  
  == Database Configuration ==
  
  The CMP engine gains access to the database used to store the entity beans via the connection
factory 
- identified by the ''cmp-connection-factory element''. This latter is a "generic" element
providing enough 
+ identified by the ''<cmp-connection-factory>'' element. This latter is a "generic"
element providing enough 
  information to identify a JDBC data source already deployed or being deployed along with
the CMP entity beans.
  
- The following snippet illustrates a typical usage of the ''cmp-connection-factory element'',
where the 
+ The following snippet illustrates a typical usage of the ''<cmp-connection-factory>''
element, where the 
  out-of-the-box connection factory, and hence database, is used.
  
  '''Snippet #1 – Defining a connection factory'''
@@ -38, +39 @@

  
  === CMP Fields ===
  
- An entity bean is mapped to a single table via the ''table-name'' element. Its persistent
fields are 
+ An entity bean is mapped to a single table via the ''<table-name>'' element. Its persistent
fields are 
- mapped to the columns of this same table via the ''cmp-field-mapping'' elements.
+ mapped to the columns of this same table via the ''<cmp-field-mapping>'' elements.
  
  The following snippet illustrates the usage of both of these elements, where:
+ 
-   * the entity bean ''BeanA'' is mapped to the table ''A''; and
+   * the entity bean ''BeanA'' is mapped to the table ''A''
+ 
    * its field ''field1'' is mapped to the column ''a1''.
  
  '''Snippet #2 – Mapping an entity bean to a table and its fields to some table columns'''
@@ -60, +63 @@

  The above configuration is the simplest one and should work in most cases as long as the
data type 
  conversion between the Java type of field1 and the SQL one of a1 can be carried out properly
as per 
  the JDBC specifications.
- In all the other scenarii, for instance where ''field1'' is a ''byte[]'' and ''a1'' is a
BLOB, two optional
+ In all the other cases, for instance where ''field1'' is a ''byte[]'' and ''a1'' is a BLOB,
two optional
  elements may be used in conjunction to control explicitly the SQL type to use and how to
perform the 
  conversion between the type of ''field1'' and the one of ''a1''. These two optional elements
are: 
- ''sql-type'',  a SQL type identifier, which must be the name of a field declared by the
''java.sql.Types''
+ ''<sql-type>'', a SQL type identifier, which must be the name of a field declared
by the ''java.sql.Types''
- class; and ''type-converter'', the full class name of a ''org.tranql.sql.Type''''''Converter''
implementation.
+ class; and ''<type-converter>'', the full class name of a ''org.tranql.sql.Type''''''Converter''
implementation.
  
  The ''org.tranql.sql.Type''''''Converter'' type defines two contracts: ''convert''''''Java''''''To''''''SQL''''''Type()''
which is used 
  to convert Java types to SQL types and ''convert''''''SQL''''''To''''''Java''''''Type()''
to realize the inverse operation.
@@ -168, +171 @@

  
  == Auto-Generated Primary Key ==
  
+ Primary keys of entity beans can be auto-generated. This can save you the trouble of providing
primary keys for entities in the create() call.  This feature may also be used to deploy entity
beans without a natural primary key, ''i.e.'' having a primary key class set to ''java.lang.Object''.
 The configuration of auto-generated primary key entity beans requires the configuration of
a ''key-generator'' element for each affected EJB.
- Primary keys of entity beans can be auto-generated. This can save you the trouble of providing
primary keys for entities in the create() call.  This feature may also used to deploy entity
beans without 
- a natural primary key, ''i.e.'' having a primary key class set to ''java.lang.Object''.
 The configuration of auto-generated primary key entity beans requires the configuration 
- of a ''key-generator'' element for each affected EJB.
  
  The children of the key-generator element define the strategy to be used to auto-generate
primary key instances. The provided strategies are:
    * ''auto-increment-table'': use table generated primary keys (auto-generated on a table
other than the entity table);
@@ -189, +190 @@

          <sequence-name>EJB_NAME</sequence-name>
          <batch-size>10</batch-size>
        </sequence-table>
-     <key-generator>
+     </key-generator>
      ...
      <key-generator>
        <auto-increment-table>
          <sql>INSERT INTO SOME_OTHER_TABLE VALUES ()</sql>
          <return-type>java.lang.Integer</return-type>
        </auto-increment-table>
-     <key-generator>
+     </key-generator>
      ...
      <key-generator>
        <sql-generator>
          <sql>SELECT MY_ORACLE_SEQ.NEXTVAL FROM DUAL</sql>
          <return-type>java.lang.Integer</return-type>
        </sql-generator>
-     <key-generator>
+     </key-generator>
      ...
      <key-generator>
        <custom-generator>
          <generator-name>geronimo.server:name=MyCustomGeneratorName</generator-name>
          <primary-key-class>java.lang.Integer</primary-key-class>
        </custom-generator>
-     <key-generator>
+     </key-generator>
  }}}
  
  Note that Geronimo does not yet handle the case where the entity table itself has a primary
key field that is automatically populated.

Mime
View raw message