Versions Compared

Key

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

...

CMP Entity Beans XML Elements:


  • <naming:cmp-connection-factory>

    The <naming:cmp-connection-factory> XML element uses the Geronimo Naming namespace, which is used to identify the common elements for resolving EJB references, resource references, and Web services references, and is described at http://geronimo.apache.org/schemas-2.1/docs/geronimo-naming-1.2.xsd.html. It is used to specify a JDBC connection pool that should be used by Container Managed Persistence (CMP) entity beans to connect to a database. Since the <naming:cmp-connection-factory> element points to a database pool using the same syntax a resource reference uses, there are multiple methods available to refer to the connection pool. It can be specified by a simple name using the <resource-link> element, by pattern using the <pattern> element, or finally by URL using the <url> element. The resource-link handles most common resource situations where the JDBC pools are deployed as J2EE connectors in the same application, or deployed standalone in the same server. But pattern or URL can be use for any. An example openejb-jar.xml using all three techniques is shown:
Code Block
xml
xml
borderStylesolid
title<naming:cmp-connection-factory> 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>

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

</openejb-jar>


  • <ejb-ql-compiler-factory>

    The <ejb-ql-compiler-factory> XML element uses the OpenEJB default namespace for a openejb-jar.xml file that is described at http://www.openejb.org/xml/ns/openejb-jar-2.2. It is used to specify the name of a Java class that can compile EJB-QL (Query Language) queries into SQL statements for a particular database product. This must be the fully-qualified class name of a class that implements org.tranql.sql.EJBQLCompilerFactory. 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 <ejb-ql-compiler-factory> XML element is shown:
Code Block
xml
xml
borderStylesolid
title<ejb-ql-compiler-factory> 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>

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

</openejb-jar>


  • <db-syntax-factory>

    The <db-syntax-factory> XML element uses the OpenEJB default namespace for a openejb-jar.xml file that is described at http://www.openejb.org/xml/ns/openejb-jar-2.2. 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:
Code Block
xml
xml
borderStylesolid
title<db-syntax-factory> 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>

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

</openejb-jar>


  • <enforce-foreign-key-constraints>

    The <enforce-foreign-key-constraints> XML element uses the OpenEJB default namespace for a openejb-jar.xml file that is described at http://www.openejb.org/xml/ns/openejb-jar-2.2. 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>

...

Entity, Session, Message-driven EJB XML Elements:


  • <enterprise-beans>

    The <enterprise-beans> XML element uses the OpenEJB default namespace for a openejb-jar.xml file that is described at http://www.openejb.org/xml/ns/openejb-jar-2.2. It is used to specify references by <entity>, <session>, and <message-driven> EJB's.

  • <relationships>

    The <relationships> XML element uses the OpenEJB default namespace for a openejb-jar.xml file that is described at http://www.openejb.org/xml/ns/openejb-jar-2.2. Container-managed relationships are initially defined in the ejb-jar.xml deployment descriptor, but the mappings to specific database elements are defined in the openejb-jar.xml file using the <relationship> element.

  • <naming:message-destination>

    The <naming:message-destination> XML element uses the Geronimo Naming namespace, which is used to identify the common elements for resolving EJB references, resource references, and Web services references, and is described at http://geronimo.apache.org/schemas-2.1/docs/geronimo-naming-1.2.xsd.html. It is used to configure a JMS queue or topic which acts like a destination for the messages delivered.

<app:security>

The <app:security> XML element uses the Geronimo Applicaiton namespace described at http://geronimo.apache.org/schemas-2.1/docs/geronimo-application-2.0.xsd.html. It is used to maps roles specified in the WAR file to roles or principals in the security realm that will be used when deploying the module.

...