Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
28. Oct 2008, 22:22 CET | Link

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?

2 Replies:
05. Nov 2008, 04:18 CET | Link

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.

 

Dan Allen | mojavelinux.com | Author of Seam in Action

05. Nov 2008, 08:20 CET | Link

Hey Dan,

okay I will open a JIRA.

Thanks in advance!!