1 Reply Latest reply on Mar 25, 2002 11:23 AM by Hao Wu

    JBOSS 3.0 & MySQL

    Hayward Lam Newbie

      I have a very simple entity bean (CoffeeEJB) to deploy with MySQL. It seems to default to Hypersonic DB.

      Here's the steps:
      1) Add mysql-service.xml (datasource jndi name is "menagerieDS") in deploy directory
      2) Create jaws.xml to use the above jndi name to map the datasource.
      3) drop the whole jar into deploy directory.

      Here's the highlight of the deployment descriptor files.

      1) mysql-service.xml

      ConnectionURL=jdbc:mysql://localhost/menagerie
      DriverClass=org.gjt.mm.mysql.Driver
      UserName=
      menagerieDS
      ....

      It deployed ok. menagerieDS was started.

      2) ejb-jar.xml
      ...

      <ejb-name>CoffeeEJB</ejb-name>
      com.hl.CoffeeHome
      com.hl.Coffee
      <ejb-class>com.hl.CoffeeBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Coffee</abstract-schema-name>
      <cmp-field><field-name>sales</field-name></cmp-field>
      <cmp-field><field-name>total</field-name></cmp-field>
      <cmp-field><field-name>supplierId</field-name></cmp-field>
      <cmp-field><field-name>price</field-name></cmp-field>
      <primkey-field>name</primkey-field>
      <security-identity><use-caller-identity/></security-identity>

      ....

      3) jboss.xml

      <enterprise-beans>

      <ejb-name>CoffeeEJB</ejb-name>
      <jndi-name>ejb/CoffeeEJB</jndi-name>

      </enterprise-beans>


      4) jaws.xml

      menagerieDS
      <type-mapping>mySQL</type-mapping>

      <enterprise-beans>

      <ejb-name>CoffeeEJB</ejb-name>
      <table-name>coffee</table-name>
      <remove-table>true</remove-table>
      <cmp-field>
      <field-name>name</field-name>
      <column-name>COF_NAME</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(32)</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>supplierId</field-name>
      <column-name>SUP_ID</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>price</field-name>
      <column-name>PRICE</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>sales</field-name>
      <column-name>SALES</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>total</field-name>
      <column-name>TOTAL</column-name>
      </cmp-field>


      </enterprise-beans>


      Any idea why it defaults to use Hypersonic instead of mySQL????

      Hayward