2 Replies Latest reply on Sep 24, 2002 12:52 PM by Michael

    JBoss 3.0 Changing Datasource in CMP bean using Xdoclet

    Michael Newbie

      Can someone explain, if its possible to change the Default DataSource tags of my CMP bean from Hypersonic Sql to MySql using the xdoclet tags?

      Everytime I build my EJB, the jbosscmp-jdbc.xml file
      looks like the following

      ?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">


      <datasource-mapping>Hypersonic SQL</datasource-mapping>







      To define load groups for this entity, write a file named
      jbosscmp-jdbc-load-TestCMPMySqlEntityBean.xml and put it in
      your mergedir. Write it according to the following DTD slice:
      <!ELEMENT load-groups (load-group+)>
      <!ELEMENT load-group (load-group-name, description?, field-name+)>
      <!ELEMENT load-group-name (#PCDATA)>
      <!ELEMENT description (#PCDATA)>
      <!ELEMENT field-name (#PCDATA)>
      <!ELEMENT eager-load-group (#PCDATA)>
      <!ELEMENT lazy-load-groups (load-group-name+)>





      -- Thanks

        • 1. Re: JBoss 3.0 Changing Datasource in CMP bean using Xdoclet
          koo Newbie

          you have to deploy a mysql-service.xml

          in your xdoclet build target you specify jboss as server target and mysql as a data source
          like this(this is for oracle chage with mysql)


          • 2. Re: JBoss 3.0 Changing Datasource in CMP bean using Xdoclet
            Michael Newbie

            Thanks for the reply. Actually, what I ended up doing
            is the following.
            1) Using the template project scheme Andreas has put together. By the way it is very useful and easy to follow to build J2EE apps.

            2) Modifying the template build.xml file and specifically modify the .ant.properties file and change 2 entries below.

            # Set the DB type mapping (Hypersonic SQL, PostgreSQL etc., see XDoclet's attribute "typemapping")
            # Set the DataSource name your are going to use (java:/DefaultDS etc., see XDoclet's attribute "datasource")

            The ejbdoclet task under the target in the build.xml
            ( <target name="xdoclet-generate" )
            will read in these environment properties and generate the proper deployment descriptor xml files under the META-INF.
            Under the DataSource where I had the default
            HyperSonic DataSource


            <datasource-mapping>Hypersonic SQL</datasource-mapping>

            It NOW Changes to the proper ones I want. I just have to make sure the datasource entry is already bound in JBOSS.