-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: database auto generating schemaexport
PostPosted: Fri Jun 11, 2010 12:58 pm 
Newbie

Joined: Fri Jun 11, 2010 11:08 am
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.