I have a folder called practice2 that is in the hibernate-2.1 folder. In the folder I havea Collection.java class, a Collection.hbm.xml file, among other .java files. I believe the files work because if I manually create the tables, I can like store info into the tables.
My problem is trying to create a table using the scema export tool. It seems to not create a table and gives an error message too.
My hibernate.properties file is in the hibernate-2.1/src folder. My database is MySQL.
So here is my build script:
<project name="kenny" default="compile" basedir=".">
<property name="src" value="."/>
<property name="build" value="build"/>
<target name="init">
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<!-- Compile the java code -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
<!-- from an Ant build.xml -->
<target name="init-db">
<taskdef classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="project.class.path" name="schemaexport"/>
<schemaexport delimiter=";" drop="false" output="schema.sql" properties="config/hibernate.properties" quiet="false" text="false">
<fileset dir="${build.destdir}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>
<target
name="create-tables"
depends="init-db"
description="Create tables"
>
<echo>Creating tables using URL ${database.url}</echo>
<sql
classpath="${database.driver.classpath}"
driver="${database.driver}"
url="${database.url}"
userid="${database.userid}"
password="${database.password}"
src="${database.script.file}"
print="true"
output="result.txt"
/>
</target>
</project>
When I type 'ant' into the command line when I am in the practice2 folder, I get the error message: 'Content is not allowed in prolog.'
Does anyone know what the problem is? All I am aiming for at this point is to create a table using schema export. So if anyone who got the schema export tool working could look over my build script and give some pointers, that would be appreciated.
Thank you,
Mush
|