-->
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.  [ 3 posts ] 
Author Message
 Post subject: The error of Schemaexport
PostPosted: Tue Jul 19, 2005 10:41 am 
Newbie

Joined: Thu Jan 08, 2004 2:27 am
Posts: 1
I use Ant to run Schemaexport to create the table. But when I run the build.xml, I alway got the following error information. I checked all the files and the path. Everything is right.
--------------------------------------------
Buildfile: C:\java\software\workingplace\eclipse\workspace\Hibernate3_Test\build.xml
shemaexport:
[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:\java\software\workingplace\eclipse\workspace\Hibernate3_Test\build.xml:43: Schema text failed: Resource: org/gaofeng/hibernate/hbm/Event.hbm.xml not found
---------------------------------------------

Here are my all xml file:

1. hibernate.cfg.xml:
--------------------------------
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.username">gaofeng</property>
<property name="connection.password">gaofeng</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="connection.url">jdbc:postgresql:hibernate</property>
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="show_sql">true</property>

<mapping resource="org/gaofeng/hibernate/hbm/Event.hbm.xml"/>
</session-factory>
</hibernate-configuration>



2. build.xml
-----------------------------------
<project name="hibernate-tutorial" default="compile">
<property name="sourcedir" value="${basedir}/src"/>
<property name="targetdir" value="${basedir}/classes"/>
<property name="libdir" value="${basedir}/lib"/>

<path id="libraries">
<fileset dir="${libdir}">
<include name="**/*.jar"/>
</fileset>
</path>

<target name="clean">
<delete dir="${targetdir}"/>
<mkdir dir="${targetdir}"/>
</target>

<target name="copy-resources">
<copy todir="${targetdir}">
<fileset dir="${sourcedir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>

<target name="compile" depends="clean,copy-resources">
<javac srcdir="${sourcedir}"
destdir="${targetdir}"
classpathref="libraries"/>
</target>

<target name="shemaexport" depends="compile">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="libraries">
</taskdef>

<schemaexport
config="${targetdir}/hibernate.cfg.xml"
quiet="yes"
text="yes"
drop="yes"
delimiter=";"
output="schema-export.sql">
<fileset dir="${targetdir}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>

</project>


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 4:51 pm 
Regular
Regular

Joined: Tue Nov 09, 2004 5:15 pm
Posts: 100
I don't see the property "basedir" defined in the build.xml. Is it defined?


Top
 Profile  
 
 Post subject: Re: The error of Schemaexport
PostPosted: Mon Jul 25, 2005 3:35 am 
Newbie

Joined: Sun Jul 24, 2005 4:31 am
Posts: 3
You could try to add your hbms to 'schema-export' target:

<!-- your classes and libraries -->
<path id="class.path">
<fileset dir="${libdir}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${targetdir}"/>
</path>

<target name="shemaexport" depends="compile">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="class.path">
</taskdef>

So, shemaexport's classpathref will point to your libraries, classes and hbms as well.
Hope this helps.


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

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.