Hi,
I'm trying to generate database from hibernate mapping file (*.hbm.xml) with adding script in (Ant) build.xml file
the script which i added is ;
Code:
<target name="schemaexport" depends="compile">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="libraries" />
<schemaexport
config="${basedir}/src/hibernate.cfg.xml"
quiet="no"
text="yes"
delimiter=";"
create="yes"
output="${basedir}/generated-schema.sql"
includes="**/*.hbm.xml"/>
</target>
and the configuration file (cfg.xml) contain:
Code:
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/BaseT</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
<mapping resource="events/Event.hbm.xml"/>
</session-factory>
</hibernate-configuration>
but i have Error
clean:
[delete] Deleting directory C:\Documents and Settings\workspace\testSchExp\bin
[mkdir] Created dir: C:\Documents and Settings\workspace\testSchExp\bin
copy-resources:
[copy] Copying 3 files to C:\Documents and Settings\workspace\testSchExp\bin
[copy] Copied 2 empty directories to 1 empty directory under C:\Documents and Settings\El Asmi\workspace\testSchExp\bin
compile:
[javac] Compiling 3 source files to C:\Documents and Settings\workspace\testSchExp\bin
schemaexport:
[schemaexport] Running Hibernate Core SchemaExport.
[schemaexport] This is an Ant task supporting only mapping files, if you want to use annotations see
http://tools.hibernate.org.
[schemaexport] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[schemaexport] log4j:WARN Please initialize the log4j system properly.
BUILD FAILED
C:\Documents and Settings\workspace\testSchExp\build.xml:50: Schema text failed: resource: events/Event.hbm.xml not found and i haven't understand where is the problem exactlly
Thanks a lot for you help