Hello,
i use HibernateToolTask's hbm2ddl to generate ddl file from mapping file.
However, after i ran it by ant, all seems ok and DB has been created successfully, while i couldn't find the ddl file in the output directory.
So, some one could give me some suggestions ?
Thanks !
----------------------------------------------
Build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="export ddl" default="schemaexport">
<property name="project.classpath" value="../" />
<property name="build.classpath"
value="${project.classpath}/build/" />
<property name="buildlib.classpath" value="${build.classpath}/lib" />
<property name="war.classpath"
value="${project.classpath}/xdriveWeb/WebContent" />
<property name="src.classpath"
value="${project.classpath}/xdriveWeb/src" />
<path id="build.path">
<fileset dir="${buildlib.classpath}">
<include name="*.jar" />
</fileset>
<pathelement location="${src.classpath}" />
</path>
<target name="schemaexport">
<taskdef name="hbm2ddl"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="build.path" />
<hbm2ddl destdir="${build.classpath}">
<configuration
configurationfile="hibernate-mappings.cfg.xml" />
<hbm2ddl export="true" console="true" create="true"
update="true" drop="false" outputfilename="export.sql" />
</hbm2ddl>
</target>
</project>
--------------------------------------------------------------------
log
Buildfile: C:\Temp\web\trunk\build\SchemaExport.xml
schemaexport:
[hbm2ddl] Executing Hibernate Tool with a Standard Configuration
[hbm2ddl] 1. task: hbm2ddl (Generates database schema)
[hbm2ddl] 2006-12-28 14:43:04,104 INFO [org.hibernate.cfg.Environment] - <Hibernate 3.2 cr4>
[hbm2ddl] 2006-12-28 14:43:04,150 INFO [org.hibernate.cfg.Environment] - <hibernate.properties not found>
[hbm2ddl] 2006-12-28 14:43:04,150 INFO [org.hibernate.cfg.Environment] - <Bytecode provider name : cglib>
[hbm2ddl] 2006-12-28 14:43:04,166 INFO [org.hibernate.cfg.Environment] - <using JDK 1.4 java.sql.Timestamp handling>
[hbm2ddl] 2006-12-28 14:43:04,523 INFO [org.hibernate.cfg.Configuration] - <configuring from file: hibernate-mappings.cfg.xml>
[hbm2ddl] 2006-12-28 14:43:05,922 INFO [org.hibernate.cfg.Configuration] - <Reading mappings from resource: com/xdrive/business/model/NewsModel.hbm.xml>
[hbm2ddl] 2006-12-28 14:43:06,248 INFO [org.hibernate.cfg.HbmBinder] - <Mapping class: com.xdrive.business.model.NewsModel -> NEWSMODEL>
[hbm2ddl] 2006-12-28 14:43:06,326 INFO [org.hibernate.cfg.Configuration] - <Reading mappings from resource: com/xdrive/business/model/BaseBusinessModel.hbm.xml>
[hbm2ddl] 2006-12-28 14:43:06,404 INFO [org.hibernate.cfg.HbmBinder] - <Mapping class: com.xdrive.business.model.BaseBusinessModel -> BaseBusinessModel>
[hbm2ddl] 2006-12-28 14:43:06,404 INFO [org.hibernate.cfg.HbmBinder] - <Mapping collection: com.xdrive.business.model.BaseBusinessModel.autoList -> R_AUTO>
[hbm2ddl] 2006-12-28 14:43:06,512 INFO [org.hibernate.cfg.Configuration] - <Reading mappings from resource: com/xdrive/business/model/AutoInfoModel.hbm.xml>
[hbm2ddl] 2006-12-28 14:43:06,590 INFO [org.hibernate.cfg.HbmBinder] - <Mapping class: com.xdrive.business.model.AutoInfoModel -> AutoInfoModel>
[hbm2ddl] 2006-12-28 14:43:06,590 INFO [org.hibernate.cfg.Configuration] - <Configured SessionFactory: null>
[hbm2ddl] 2006-12-28 14:43:07,010 INFO [org.hibernate.dialect.Dialect] - <Using dialect: org.hibernate.dialect.MySQLDialect>
[hbm2ddl] 2006-12-28 14:43:07,025 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - <Running hbm2ddl schema update>
[hbm2ddl] 2006-12-28 14:43:07,025 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - <fetching database metadata>
[hbm2ddl] 2006-12-28 14:43:07,041 INFO [org.hibernate.connection.DriverManagerConnectionProvider] - <Using Hibernate built-in connection pool (not for production use!)>
[hbm2ddl] 2006-12-28 14:43:07,041 INFO [org.hibernate.connection.DriverManagerConnectionProvider] - <Hibernate connection pool size: 20>
[hbm2ddl] 2006-12-28 14:43:07,041 INFO [org.hibernate.connection.DriverManagerConnectionProvider] - <autocommit mode: false>
[hbm2ddl] 2006-12-28 14:43:07,056 INFO [org.hibernate.connection.DriverManagerConnectionProvider] - <using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/xproject>
[hbm2ddl] 2006-12-28 14:43:07,056 INFO [org.hibernate.connection.DriverManagerConnectionProvider] - <connection properties: {user=x_user, password=****}>
[hbm2ddl] 2006-12-28 14:43:07,600 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - <updating schema>
[hbm2ddl] 2006-12-28 14:43:07,694 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <table found: xproject.autoinfomodel>
[hbm2ddl] 2006-12-28 14:43:07,694 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <columns: [autocolor, autobrand, serial_number, autotype, create_date, id]>
[hbm2ddl] 2006-12-28 14:43:07,694 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <foreign keys: []>
[hbm2ddl] 2006-12-28 14:43:07,694 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <indexes: [primary]>
[hbm2ddl] 2006-12-28 14:43:07,771 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <table found: xproject.basebusinessmodel>
[hbm2ddl] 2006-12-28 14:43:07,771 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <columns: [address, remark, id, create_date, longitude, auto_type, scale, groupe, service_time, web_site, latitude, name, phone_number]>
[hbm2ddl] 2006-12-28 14:43:07,771 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <foreign keys: []>
[hbm2ddl] 2006-12-28 14:43:07,771 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <indexes: [primary]>
[hbm2ddl] 2006-12-28 14:43:07,833 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <table found: xproject.newsmodel>
[hbm2ddl] 2006-12-28 14:43:07,833 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <columns: [description, create_date, id]>
[hbm2ddl] 2006-12-28 14:43:07,833 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <foreign keys: []>
[hbm2ddl] 2006-12-28 14:43:07,833 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <indexes: [primary]>
[hbm2ddl] 2006-12-28 14:43:07,927 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <table found: xproject.r_auto>
[hbm2ddl] 2006-12-28 14:43:07,927 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <columns: [auto_id, bbm_id, id]>
[hbm2ddl] 2006-12-28 14:43:07,927 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <foreign keys: [fk9146f17cea6dcf3, fk9146f17c352ce863, fk9146f17cc6e1e581, fk9146f17c1a0f082f]>
[hbm2ddl] 2006-12-28 14:43:07,927 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - <indexes: [fk9146f17cea6dcf3, primary, fk9146f17c352ce863, fk9146f17cc6e1e581, fk9146f17c1a0f082f]>
[hbm2ddl] 2006-12-28 14:43:08,035 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - <schema update complete>
[hbm2ddl] 2006-12-28 14:43:08,035 INFO [org.hibernate.connection.DriverManagerConnectionProvider] - <cleaning up connection pool: jdbc:mysql://localhost:3306/xproject>
BUILD SUCCESSFUL
Total time: 6 seconds
----------------------------------------------------
|