Here you go,
I didn't look at the myqsl logs, but "Table 'ProjObject' already exists"
says it all :)
Bas
-ant target-
Code:
<target name="schemaupdate" depends="hibernate,jar">
<taskdef name="schemaupdate"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask">
<classpath>
<fileset dir="${tomcat.lib.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${hibernate.lib.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${hibernate.lib.home}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${build}/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
<schemaupdate
properties="hibernate.properties"
quiet="no">
<fileset dir="${build}/conf/">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaupdate>
</target>
-hibernate mapping-
Code:
[X@X Proj]$ cat build/conf/ProjObject.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="ProjObject"
dynamic-update="true"
dynamic-insert="true"
>
<id
name="id"
column="id"
type="int"
>
<generator class="native">
</generator>
</id>
<property
name="created"
type="java.util.Date"
update="true"
insert="true"
column="created"
not-null="true"
/>
</class>
</hibernate-mapping>
-hibernate.properties-
Code:
[X@X Proj]$ cat hibernate.properties
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
hibernate.connection.url jdbc:mysql://127.0.0.1/Proj2?user=X&password=X
hibernate.connection.username X
hibernate.connection.password X
hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
hibernate.show_sql true
-schemaupdate result-
Code:
[X@X Proj]$ ant schemaupdate
Buildfile: build.xml
init:
compile:
jar:
schemaupdate:
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.cfg.Environment <clinit>
[schemaupdate] INFO: Hibernate 2.0.3
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.cfg.Environment <clinit>
[schemaupdate] INFO: hibernate.properties not found
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.cfg.Environment <clinit>
[schemaupdate] INFO: using CGLIB reflection optimizer
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.cfg.Environment <clinit>
[schemaupdate] INFO: JVM proxy support: true
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.cfg.Configuration addFile
[schemaupdate] INFO: Mapping file: /home/X/workspace/Proj/build/conf/ProjObject.hbm.xml
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.cfg.Binder bindRootClass
[schemaupdate] INFO: Mapping class: ProjObject -> ProjObject
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.dialect.Dialect <init>
[schemaupdate] INFO: Using dialect: net.sf.hibernate.dialect.MySQLDialect
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[schemaupdate] INFO: Hibernate connection pool size: 20
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[schemaupdate] INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://127.0.0.1/Proj2?user=X&password=X
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
[schemaupdate] INFO: connection properties: {user=X , password=X }
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.cfg.Configuration secondPassCompile
[schemaupdate] INFO: processing one-to-many association mappings
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.cfg.Configuration secondPassCompile
[schemaupdate] INFO: processing foreign key constraints
[schemaupdate] create table ProjObject (id INTEGER NOT NULL AUTO_INCREMENT, created DATETIME not null, primary key (id))
[schemaupdate] Nov 4, 2003 3:04:59 PM net.sf.hibernate.tool.hbm2ddl.SchemaUpdate execute
[schemaupdate] SEVERE: Error while executing create table ProjObject (id INTEGER NOT NULL AUTO_INCREMENT, created DATETIME not null, primary key (id))
[schemaupdate] java.sql.SQLException: General error, message from server: "Table 'ProjObject' already exists"
[schemaupdate] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
[schemaupdate] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1020)
[schemaupdate] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1109)
[schemaupdate] at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1070)
[schemaupdate] at com.mysql.jdbc.Connection.execSQL(Connection.java:2027)
[schemaupdate] at com.mysql.jdbc.Connection.execSQL(Connection.java:1984)
[schemaupdate] at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1248)
[schemaupdate] at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1194)
[schemaupdate] at net.sf.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:116)
[schemaupdate] at net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask.execute(SchemaUpdateTask.java:87)
[schemaupdate] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
[schemaupdate] at org.apache.tools.ant.Task.perform(Task.java:341)
[schemaupdate] at org.apache.tools.ant.Target.execute(Target.java:309)
[schemaupdate] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[schemaupdate] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[schemaupdate] at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[schemaupdate] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[schemaupdate] at org.apache.tools.ant.Main.start(Main.java:196)
[schemaupdate] at org.apache.tools.ant.Main.main(Main.java:235)
-</SNIP>-