Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Geronimo uses the OpenEJB container for providing EJB services. With the advent of JAVA Java EE, the EJB container services such as transaction management, security, life cycle management can be declared in the EJB class itself using annotations. However, the EJB deployment descriptor can still be provided via usage of the ejb-jar.xml file. When both annotations and the ejb-jar.xml file are provided, the ejb-jar.xml file takes precedence over the annotations.

...

Code Block
xml
xml
borderStylesolid
title<sys:environment> Example
<openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
             xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">

    <sys:environment>
        <sys:moduleId>
            <sys:groupId>default</sys:groupId>
            <sys:artifactId>openejb-jar-1</sys:artifactId>
            <sys:version>2.0</sys:version>
            <sys:type>ear</sys:type>
        </sys:moduleId>

        <sys:dependencies>
            <sys:dependency>
                <sys:groupId>org.apache.geronimo.testsuite</sys:groupId>
                <sys:artifactId>agent-ds</sys:artifactId>
                <sys:version>2.2-SNAPSHOT</sys:version>
                <sys:type>car</sys:type>
            </sys:dependency>

            <sys:dependency>
                <sys:groupId>org.apache.geronimo.configs</sys:groupId>
                <sys:artifactId>tomcat6</sys:artifactId>
                <sys:version>2.2-SNAPSHOT</sys:version>
                <sys:type>car</sys:type>
            </sys:dependency>
        </sys:dependencies>
    </sys:environment>

</openejb-jar>



CMP Entity Beans

...

Container Managed Persistence (CMP) is still fully supported in OpenEJB/Geronimo, although the Java Persistence API is generally considered a better approach in Java EE. Apache Geronimo uses OpenJPA for providing Java Persistence API to Java EE applications deployed in the server. More information and details about the JPA deployment descriptor can be found here: Java Persistence API deployment plans.

<naming:cmp-connection-factory>

...

The <db-syntax-factory> XML element uses the OpenEJB default namespace for a openejb-jar.xml file that is described at , which is documented here:

The <db-syntax-factory> element . It is used to specify the name of a Java class that can customize CMP SQL statements for a particular database product. This must be the fully-qualified class name of a class that implements org.tranql.sql.DBSyntaxFactory. The default is for the Derby database, which ships with Geronimo, although it may work for other database products as well. An example openejb-jar.xml using the <db-syntax-factory> XML element is shown:

...

The <enforce-foreign-key-constraints> XML element uses the OpenEJB default namespace for a openejb-jar.xml file that is described at http:, which is documented here:

The <enforce-foreign-key-constraints> element . This is effectively a true/false element – if it's present that means true, and if it's not present, that means false. If true, then Geronimo will make a special effort to execute insert, update, and delete statements in an order consistent with the foreign keys between tables. If false, then Geronimo will execute statements in any order, though still within the same transaction. This element should be present if the underlying database enforces foreign keys at the moment a statement is executed instead of at the end of the transaction. An example openejb-jar.xml setting the <db-syntax-factory> XML element to "true" is shown:

Code Block
xml
xml
borderStylesolid
title<enforce-foreign-key-constraints> Example
<openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
             xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"
             xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2">

    <sys:environment>
        <sys:moduleId>
            <sys:groupId>default</sys:groupId>
            <sys:artifactId>openejb-jar-1</sys:artifactId>
            <sys:version>2.0</sys:version>
            <sys:type>ear</sys:type>
        </sys:moduleId>

        <sys:dependencies>
            <sys:dependency>
                <sys:groupId>org.apache.geronimo.testsuite</sys:groupId>
                <sys:artifactId>agent-ds</sys:artifactId>
                <sys:version>2.2-SNAPSHOT</sys:version>
                <sys:type>car</sys:type>
            </sys:dependency>

            <sys:dependency>
                <sys:groupId>org.apache.geronimo.configs</sys:groupId>
                <sys:artifactId>tomcat6</sys:artifactId>
                <sys:version>2.2-SNAPSHOT</sys:version>
                <sys:type>car</sys:type>
            </sys:dependency>
        </sys:dependencies>
    </sys:environment>

    <!-- Begin configuration for Container Managed Persistence (CMP) -->

    <naming:cmp-connection-factory>
        <naming:pattern>
            <naming:groupId>resourcelocator-pattern-groupid</naming:groupId>
            <naming:artifactId>resourcelocator-pattern-artifactid</naming:artifactId>
            <naming:version>resourcelocator-pattern-version</naming:version>
            <naming:module>resourcelocator-pattern-module</naming:module>
            <naming:name>resourcelocator-pattern-name</naming:name>
        </naming:pattern>

        <naming:resource-link>resourcelocator-resourcelink</naming:resource-link>

        <naming:url>resourcelocator-url</naming:url>
    </naming:cmp-connection-factory>

    <ejb-ql-compiler-factory>ejbQlCompilerFactory</ejb-ql-compiler-factory>

    <db-syntax-factory>dbSyntaxFactory</db-syntax-factory>

    <enforce-foreign-key-constraints/>

    <!-- End configuration for Container Managed Persistence (CMP) -->

</openejb-jar>



EJB Entity Beans

EJB Entity Beans settings can include JNDI names used by remote clients, CMP settings, and COBRA configurations and resolving references. Unless otherwise noted, all the EJB Entity Beans XML element uses the OpenEJB default namespace for a openejb-jar.xml file, which is documented here:

<ejb-name>

The <ejb-name> element identifies the EJB that these settings apply to and must match the <ejb-name> for the EJB in ejb-jar.xml file.

<jndi-name>

The Home interface for the EJB is registered in JNDI at the address specified here. This global JNDI name is used by application clients to connect to this EJB. It is only meaningful if the EJB has a (remote) Home interface.

<local-jndi-name>

The LocalHome interface for the EJB is registered in JNDI at the address specified here. It is only meaningful if the EJB has a LocalHome interface.

<tssGroup>

The <tssGroup> set of elements is used to contains CORBA security settings (i.e., for EJBs exposed as CORBA objects).

JNDI Environment References

All the JNDI reference elements in this section use the Geronimo Naming namespace, which is used to identify the common elements for resolving EJB references, resource references, and Web services references, and is documented here:

Additionally, more information and details about JNDI references can be found here: JNDI.

<naming:abstract-naming-entry>

The <abstract-naming-entry> element is not technically a JNDI reference element. It is included in this section because it is an abstract element used for containing these JNDI reference types:

  • <gbean-ref>

    The <gbean-ref> element is used to map GBean references to GBeans configured outside the current module

  • <persistenceunit-ref>

    The <persistenceunit-ref> element is used to map persistence unit references to persistence units configured outside the current module

  • <persistencecontext-ref>

    The <persistencecontext-ref> element is used to map persistence context references to persistence contexts configured outside the current module
<naming:ejb-ref>

The <naming:ejb-ref> element is used to map EJB references to EJB's in other applications using remote home and remote interface. The application which contains the EJB being referenced should either be in same EAR or should be included in dependency list of this application. Also note as the EJB's referenced are in a different JVM all the client interfaces should also be included in the current application.

<naming:ejb-local-ref>

The <naming:ejb-local-ref> element is used to map EJB references to EJB's in other applications using local home and local interface. The application which contains the EJB being referenced should either be in same EAR or should be included in dependency list of this application. Also note as the EJB's referenced are in a different JVM all the client interfaces should also be included in the current application.

<naming:service-ref>

The <naming:service-ref> is used to map service references to service's in other applications. The application which contains the EJB being referenced should either be in same EAR or should be included in dependency list of this application.

<naming:resource-ref>

The <naming:resource-ref> element is used to map resource references to resources like JDBC resources, JMS resources, etc. configured outside the current application.

<naming:resource-env-ref>

The <naming:resource-env-ref> element is used to map resource references to administrative objects deployed as a part of connectors.

<naming:message-destination>

The <naming:message-destination> element is used to map resource references to a message-destination which is used within the deployed web application. These are typically a JMS queue or topic which acts like a destination for the messages delivered. Like all the JNDI references in this section, this element will not cause the creation of a message-destination, references an existing message-destination used within the deployed web application.

EJB Session Entity Beans

EJB Message-driven Beans

Entity, Session, Message-driven EJB XML Elements:

...