2 Replies Latest reply on Nov 5, 2008 8:20 AM by nimo22

    SEAM 2.1 - ANT FILE

    nimo22

      I found out, that now there is another task in seams ant-file:


      Javadoc-Ant-Task - really nice!


      I wanna ask, if there is possible to integrate an ANT-TASK in SEAMs Ant-File, which produces a SQL-script from the given Entity-Beans.


      I know, it s JPA-related and for example in the hibernate-documenation there are hints how to implement an ant-task,
      but I am not able to achieve that - in hibernate-forums there are different solutions for that..I find, all does not really work easy or have bugs!


      How about an ant-taks in SEAM, in which we can select the kind of database (MYSQL, or the like), the entity-beans for our sql-script and the output-file. Something like:


      <database schema="#{mySQL}" entityBeans="{package.xy}" outputFile ="#{resources.sqlFiles}" relatedLibraries="#{database-drivers}"/>




      I tried it with an ant task like that, but it does not work:


      <!-- SQL Generation
           <path id="toolslib">
            <path location="lib/hibernate-tools.jar" />
            <path location="lib/hibernate3.jar" />
            <path location="lib/freemarker.jar" />
            <path location="${jdbc.driver.jar}" />
           </path>
      
           <taskdef name="hibernatetool"
                    classname="org.hibernate.tool.ant.HibernateToolTask"
                    classpathref="toolslib" />
      
           <target name="schemaexport" depends="compile">
                <hibernatetool destdir="${basedir}">
                     <configuration configurationfile="${basedir}/hibernate.cfg.xml"/>
                     <hbm2ddl drop="false" create="false" export="false" outputfilename="helloworld-ddl.sql" delimiter=";" format="true"/>
                </hibernatetool>
           </target>
      
           -->



      It would be really really nice to have an ant-task or a Seam-Method to achieve that in an easier way.


      Or have anybody an ant-task for generation sql-scripts from given entityBeans which works well?

        • 1. Re: SEAM 2.1 - ANT FILE
          dan.j.allen

          Not a bad suggestion. As you know, when the application comes up, you can have the database created automatically using

          hibernate.hbm2ddl.auto="create"

          , but I can see the use in being able to export the schema from the build, perhaps to help with scripting. If you file a JIRA and attach some concept code I think we can make it happen.

          • 2. Re: SEAM 2.1 - ANT FILE
            nimo22

            Hey Dan,


            okay I will open a JIRA.


            Thanks in advance!!