Ant task does not generate db schema
------------------------------------

         Key: ANT-28
         URL: http://jira.andromda.org/browse/ANT-28
     Project: Ant
        Type: Bug
 Environment: Fedra core3
JDK 1.4.2.04
    Reporter: Steven Zhang
 Assigned to: Martin West 


As the title said,the ant task does not generate db schema.
So I need workaround that add a addation ant task to generate the db schema.
It would be nice if andromda handle it.
Here is my implementation of ant task.
        <!-- collect hiberante mapping files -->
        <path id="hibernate.mapping.files">
                <fileset dir="${gen.src.dir}">
                        <include name="**/*.hbm.xml"/>
                </fileset>
        </path>
       <pathconvert refid="hibernate.mapping.files" 
property="hibernate.mappings" pathsep=" "/>
        <!-- export db schema -->
        <target name="exportSchema">
                <java classname="net.sf.hibernate.tool.hbm2ddl.SchemaExport" 
fork="true">
            <arg 
value="--output=${schema.dir}/${sql.mappings}/schema-create.sql"/>
            <arg value="--text"/>
            <arg value="--quiet"/>
            <arg value="--delimiter=;"/>
            <arg value="--format"/>
            <arg line="${hibernate.mappings}"/>
            <jvmarg value="-Dhibernate.dialect=${hibernate.db.dialect}"/>
            <classpath refid="schema.lib.path" />
        </java>
        <replaceregexp file="${schema.dir}/${sql.mappings}/schema-create.sql"
               match="^(alter table .* drop constraint|drop table)"
               replace="-- SKIP \1"
               flags="i"
               byline="true"/>
    </target>

Thank you
Steven




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

Reply via email to