Happy to help.  Here are the 3 files from the META-INF directory of my 
jBoss inplementation of O'Rielly's "Enterprise Java Beans, 2d Ed" by 
Monson-Haefel.  This is the Cabin bean in Ch 4.

----------------------------------------------------------------------

ejb-jar.xml -- note the <resource-ref> tag under <entity>

<?xml version="1.0"?>

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise 
JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">

<ejb-jar>
   <enterprise-beans>
     <entity>
       <description>
         This Cabin enterprise bean entity represents a cabin on a cruise ship.
       </description>
       <ejb-name>CabinBean</ejb-name>
       <home>com.titan.cabin.CabinHome</home>
       <remote>com.titan.cabin.Cabin</remote>
       <ejb-class>com.titan.cabin.CabinBean</ejb-class>
       <persistence-type>Container</persistence-type>
       <prim-key-class>com.titan.cabin.CabinPK</prim-key-class>
       <reentrant>False</reentrant>

       <cmp-field>
         <field-name>id</field-name>
       </cmp-field>
       <cmp-field>
         <field-name>name</field-name>
       </cmp-field>
       <cmp-field>
         <field-name>deckLevel</field-name>
       </cmp-field>
       <cmp-field>
         <field-name>ship</field-name>
       </cmp-field>
       <cmp-field>
         <field-name>bedCount</field-name>
       </cmp-field>

       <resource-ref>
               <res-ref-name>oreillyEJB2</res-ref-name>
               <res-type>javax.sql.DataSource</res-type>
               <res-auth>Container</res-auth>
       </resource-ref>
     </entity>
   </enterprise-beans>

  <assembly-descriptor>
    <security-role>
       <description>
          This role represents everyone who is allowed full access
          to the cabin bean.
       </description>
      <role-name>everyone</role-name>
    </security-role>

    <method-permission>
      <role-name>everyone</role-name>
      <method>
          <ejb-name>CabinBean</ejb-name>
          <method-name>*</method-name>
      </method>
    </method-permission>

    <container-transaction>
      <method>
         <ejb-name>CabinBean</ejb-name>
         <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
    </container-transaction>
  </assembly-descriptor>
</ejb-jar>

----------------------------------------------------------------------

jaws.xml -- note the <datasource> which ties back to the one declared
in my jboss.conf file

<?xml version="1.0" encoding="UTF-8"?>

<jaws>

   <datasource>OptixConnectionPool</datasource>
   <type-mapping>Oracle</type-mapping>

   <default-entity>
     <create-table>true</create-table>
     <remove-table>false</remove-table>
     <tuned-updates>true</tuned-updates>
     <read-only>false</read-only>
     <time-out>300</time-out>
     </default-entity>

   <type-mappings>
     <type-mapping>

       <name>Oracle</name>
       <mapping>
         <java-type>java.lang.Long</java-type>
                 <jdbc-type>BIGINT</jdbc-type>
                 <sql-type>NUMBER</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.lang.String</java-type>
                 <jdbc-type>VARCHAR</jdbc-type>
                 <sql-type>VARCHAR(256)</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.lang.Character</java-type>
                 <jdbc-type>CHAR</jdbc-type>
                 <sql-type>CHAR</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.lang.Short</java-type>
                 <jdbc-type>INTEGER</jdbc-type>
                 <sql-type>NUMBER</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.sql.TimeStamp</java-type>
                 <jdbc-type>TIMESTAMP</jdbc-type>
                 <sql-type>TIMESTAMP</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.lang.Double</java-type>
                 <jdbc-type>DOUBLE</jdbc-type>
                 <sql-type>NUMBER</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.lang.Byte</java-type>
                 <jdbc-type>TINYINT</jdbc-type>
                 <sql-type>NUMBER</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.lang.Boolean</java-type>
                 <jdbc-type>BIT</jdbc-type>
                 <sql-type>NUMBER</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.lang.Float</java-type>
                 <jdbc-type>FLOAT</jdbc-type>
                 <sql-type>NUMBER</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.lang.Object</java-type>
                 <jdbc-type>JAVA_OBJECT</jdbc-type>
                 <sql-type>JAVA_OBJECT</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.util.Date</java-type>
                 <jdbc-type>DATE</jdbc-type>
                 <sql-type>DATE</sql-type>
             </mapping>
             <mapping>
                 <java-type>java.lang.Integer</java-type>
                 <jdbc-type>INTEGER</jdbc-type>
                 <sql-type>NUMBER</sql-type>
             </mapping>

     </type-mapping>
   </type-mappings>

   <enterprise-beans>
     <entity>
       <ejb-name>CabinBean</ejb-name>
       <table-name>cabin</table-name>
       <create-table>false</create-table>
       <remove-table>false</remove-table>
       <read-only>false</read-only>

       <cmp-field>
         <field-name>id</field-name>
         <column-name>ID</column-name>
       </cmp-field>
       <cmp-field>
         <field-name>ship</field-name>
         <column-name>SHIP_ID</column-name>
       </cmp-field>
       <cmp-field>
         <field-name>name</field-name>
         <column-name>NAME</column-name>
       </cmp-field>
       <cmp-field>
         <field-name>bedCount</field-name>
         <column-name>BED_COUNT</column-name>
       </cmp-field>
       <cmp-field>
         <field-name>deckLevel</field-name>
         <column-name>DECK_LEVEL</column-name>
       </cmp-field>
     </entity>
    </enterprise-beans>

</jaws>

----------------------------------------------------------------------

jboss.xml -- note here the <res-name> which matches <res-ref-name> in
ejb-jar.xml and <res-jndi-name> which matches <datasource> in jaws.xml

<?xml version="1.0" encoding="Cp1252"?>

<jboss>

   <resource-managers>
     <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
       <res-name>oreillyEJB2</res-name>
       <res-jndi-name>OptixConnectionPool</res-jndi-name>
     </resource-manager>
   </resource-managers>

   <enterprise-beans>
     <entity>
       <ejb-name>CabinBean</ejb-name>
       <jndi-name>CabinHome</jndi-name>
     </entity>
     <secure>false</secure>
   </enterprise-beans>

</jboss>

----------------------------------------------------------------------

At 19:41 10/2/2000 +0200, you wrote:
>Thad Humphries wrote:
> >
> > Glad to help!  I did this just last week with the BETA PROD 1 binary under
> > RedHat 6.2.  Very nice!!
>Thanks to all of you for your help, jboss starts now
>and seems to find Oracle.
>
>I just wonder how i tell my bean to use Oracle,
>it seems to prefer to put its data into Hypersonic??
>
>Marcel

--------------------------------------------------------------------------
Thad Humphries                        "Who is this that darkens my counsel
Web Development Manager                With words without knowledge?"
Phone: 540/675-3015, ext. 225                              - Job 38:1, NIV



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to