Another problem:
  The classpath element should include all of the libs required to run
xdoclet (not only the xdoclet*.jar, but also xjavadoc and the dependencies
like commons-collections, etc)... Since I donąt really know the dependencies
it is better to include all stuff on the ojb/lib directory.

    <path id="classpath.ojb">
        <fileset dir="${tool.ojb}/lib">
            <include name="**/*.jar"/>
        </fileset>
    </path>


  The rest well... Your property file seems to have made wonders but... I
think it bypassed the problems (this good... in a way).
  Still:

  - the database name that I insert on your cvs build.properties must exist
because otherwise I get a SQLException on executing the target create-db,
  - the SQLException is also thrown if I donąt use the cvs build.properties
(see below),
  - I needed to add torque.schema.dir and torque.sql.dir (schemaDir and
outputDirectory didnąt work... ) to the torque ant calls.
  - Torque is using the driver and database connection settings that are
specified on the mysql.profile that, of course are different from the ones I
specified on the cvs  build.properties. Question: why are these cvs
build.properties settings:

dbmsName=MySQL
jdbcLevel=3.0
jdbcRuntimeDriver=com.mysql.jdbc.Driver
urlProtocol=jdbc
urlSubprotocol=mysql
urlDbalias=//localhost/${databaseName}

 doing?).
  It seems that I need to setup my database settings on the mysql.profile
(correct me if I am wrong).

  There is no problem with this... I just wonder what does the cvs
properties sets up after all? If I removed them then the following exception
appears:

Target create-db
Task torque-data-model
Task echo
Task sql
build-torque.xml:321: java.sql.SQLException: General error,  message from
server: "Unknown database 'ojb'"

  This shouldn't appear because:
  1- I am not using a database yet... I want to create the required database
if it doesnąt exist
  2- anyway, the database name should come from the schema file
  3- I don't have an ojb value for any of the properties I set (not on my
build.xml, not on my cvs build.properties, not even on the mysql.profile)
where does this "ojb" come from?


  Below is my working build.xml file.
  It is still missing the repository.xml and repository_database.xml
generation.

  I am reasonably acquainted with Torque (done severall repository and
transfer object generations would minor settings/problems that I was able to
solve by my own) and this Xdoclet approach is better but, this OJB-Torque
integration still needs a whole lot of testing and documentation :(.

Thank you for your help and sorry for the long email,

Pedro Salgado

<project default="repository-files">
    <!-- OJB tool blank project properties -->
    <property file="build.properties"/>


    <!-- Project specific properties -->

    <property name="dir.src" location="src"/>
    <property name="dir.java" location="${dir.src}/java"/>
    <property name="dir.sql" location="${dir.src}/sql"/>


    <!-- Metadata information -->

    <property name="dir.commons.validator"
location="${dir.src}/metadata/commons/validator"/>
    <property name="dir.horizon" location="${dir.src}/metadata/horizon"/>
    <property name="dir.ojb"     location="${dir.src}/metadata/ojb"/>
    <property name="dir.struts"  location="${dir.src}/metadata/struts"/>
    <property name="dir.taglibs" location="${dir.src}/metadata/taglibs"/>
    <property name="dir.tiles"   location="${dir.src}/metadata/tiles"/>
    <property name="dir.tomcat"  location="${dir.src}/metadata/tomcat"/>


    <!-- Code generation tools -->

    <property name="dir.tools" location="tools"/>

    <property
        name="tool.ojb"
        location="${dir.tools}/db-ojb-1.0.rc7"
        description="OJB/Torque/XDoclet code generation tool location."
    />

    <!-- OJB/Torque/XDoclet -->

    <property file="${tool.ojb}/profile/mysql.profile"/>

    <path id="classpath.ojb"
        description="The classpath to be used with the OJB model generation
tool."
    >
        <fileset dir="${tool.ojb}/lib">
            <include name="**/*.jar"/>
        </fileset>
    </path>



    <!-- Project: targets -->


    <!-- OJB/Torque/XDoclet/ tool: targets -->

    <target name="repository-files"
        description="Generates OJB and Torque metadata."
        >

        <taskdef name="ojbdoclet"
            classname="xdoclet.modules.ojb.OjbDocletTask"
            classpathref="classpath.ojb"/>

        <ojbdoclet destdir="${dir.ojb}">
            <fileset dir="${dir.java}"/>
            <ojbrepository destinationFile="repository_project.xml"/>
            <torqueschema databaseName="dbname"
destinationFile="project-schema.xml"/>
        </ojbdoclet>

    </target>

    <target name="init-db"
        description="Generates the SQL statements and creates the database
and tables."
        depends="repository-files"
        >

        <ant dir="${tool.ojb}"
            antfile="build-torque.xml"
            target="create-db"
            >
            <property name="torque.schema.dir" value="${dir.ojb}"/>
            <property name="torque.sql.dir" value="${dir.sql}"/>
        </ant>

        <ant dir="${tool.ojb}"
            antfile="build-torque.xml"
            target="sql"
            >
            <property name="torque.schema.dir" value="${dir.ojb}"/>
            <property name="torque.sql.dir" value="${dir.sql}"/>
        </ant>

        <ant dir="${tool.ojb}"
            antfile="build-torque.xml"
            target="insert-sql"
            >
            <property name="torque.schema.dir" value="${dir.java}"/>
            <property name="torque.sql.dir" value="${dir.sql}"/>
        </ant>

    </target>

</project>


> 
> http://cvs.apache.org/viewcvs.cgi/db-ojb/src/ojb-blank/build.xml?rev=1.2&view=
> markup
> http://cvs.apache.org/viewcvs.cgi/db-ojb/src/ojb-blank/build.properties?rev=1.
> 2&view=markup
> 
> Tom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to