Weblogic CMP EJB - Need to set database role for connection

Discussions

EJB programming & troubleshooting: Weblogic CMP EJB - Need to set database role for connection


  1. When implementing CMP entity beans in Weblogic, is there a way to instruct the container to retrieve it's connections from a DataSource object, or is there somewhere in the code that we can retreive a reference to the Connection object being used by the containter to interact with the database prior to any statements being executed?
  2. in weblogic-cmp-rdbms-jar.xml one has to specify the connection pool to be used ..an example is attached below.


    <!DOCTYPE weblogic-rdbms-bean PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB RDBMS Persistence//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-rdbms-persistence.dtd'>
    <weblogic-rdbms-bean>
      <pool-name>oraclePool</pool-name>
      <table-name>brand_master</table-name>
      <attribute-map>
        <object-link>
          <bean-field>brand_id</bean-field>
          <dbms-column>brand_id</dbms-column>
        </object-link>
        <object-link>
          <bean-field>brand_name</bean-field>
          <dbms-column>brand_name</dbms-column>
        </object-link>
        <object-link>
          <bean-field>brand_desc</bean-field>
          <dbms-column>brand_desc</dbms-column>
        </object-link>
      </attribute-map>
      
      <finder-list>
          <finder>
            <method-name>findByPrimaryKey</method-name>
            <method-params>
              <method-param>BrandPK</method-param>
            </method-params>
            <finder-query><![CDATA[(> brand_id $0)]]></finder-query>
          </finder>
       </finder-list>
      
       <options>
        <use-quoted-names>false</use-quoted-names>
      </options>
    </weblogic-rdbms-bean>

    I hope this will help

    shailender