-->
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.  [ 12 posts ] 
Author Message
 Post subject: Getting Errors while creating schema uisng SchemaExport
PostPosted: Mon Oct 03, 2005 7:14 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
hi,

We are trying to generate schema using the hibernate library "schemaExport".
in the build file.

but we getting the following error.

Can you pls help us in knowing the solution for this

Regards,
Srinivas

----------------------------------------------------------------------------------------------
build file
----------------------------------------------------------------------------------------
project name="hibernate-tutorial" default="compile">

<property name="basedir" value="/home/user/eclipse/workspace/hibernate3"/>
<property name="sourcedir" value="${basedir}/src"/>
<property name="targetdir" value="${basedir}/bin"/>
<property name="librarydir" value="${basedir}/lib"/>
<property name="class.path" value="${basedir}/bin"/>

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

<include name="*.class"/>
</fileset>
<fileset dir="${librarydir}">
<include name="*.jar"/>
</fileset>
</path>

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

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

<target name="copy-resources">
<copy todir="${targetdir}">
<fileset dir="${sourcedir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="run" depends="compile">
<echo message="Compiling to run the application"/>
<java fork="true" classname="EventManager" classpathref="libraries">
<classpath path="${targetdir}"/>
<arg value="${action}"/>
</java>
</target>
<target name="schemaexport">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="classes.path">
</taskdef>

<schemaexport
properties="/home/user/eclipse/workspace/hibernate3/hibernate.properties"
quiet="no"
text="no"
drop="no"
delimiter=";"
output="schema-export.sql">
<fileset dir="${sourcedir}">
<include name="Person.hbm.xml"/>
</fileset>
</schemaexport>
</target>

</project>

--------------------------------------------------------------------------------------
ERROR
--------------------------------------------------------------------------------------------
Buildfile: /home/user/eclipse/workspace/hibernate3/build.xml
schemaexport:
[schemaexport] Oct 3, 2005 2:09:34 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: Hibernate 3.0.5
[schemaexport] Oct 3, 2005 2:09:34 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: hibernate.properties not found
[schemaexport] Oct 3, 2005 2:09:34 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using CGLIB reflection optimizer
[schemaexport] Oct 3, 2005 2:09:34 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using JDK 1.4 java.sql.Timestamp handling
[schemaexport] Oct 3, 2005 2:09:34 PM org.hibernate.cfg.Configuration addFile
[schemaexport] INFO: Mapping file: /home/user/eclipse/workspace/hibernate3/src/Person.hbm.xml
[schemaexport] Oct 3, 2005 2:09:34 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
[schemaexport] INFO: Mapping class: Person -> PERSON
[schemaexport] Oct 3, 2005 2:09:35 PM org.hibernate.cfg.Configuration add
[schemaexport] SEVERE: Could not compile the mapping document
[schemaexport] org.hibernate.MappingException: class Person not found while looking for property: id
[schemaexport] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
[schemaexport] at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:275)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:360)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:294)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
[schemaexport] at org.hibernate.cfg.Configuration.add(Configuration.java:362)
[schemaexport] at org.hibernate.cfg.Configuration.addFile(Configuration.java:228)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[schemaexport] Caused by: java.lang.ClassNotFoundException: Person
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
[schemaexport] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
[schemaexport] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[schemaexport] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
[schemaexport] at java.lang.Class.forName0(Native Method)
[schemaexport] at java.lang.Class.forName(Class.java:141)
[schemaexport] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
[schemaexport] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
[schemaexport] ... 17 more
[schemaexport] Oct 3, 2005 2:09:35 PM org.hibernate.cfg.Configuration addFile
[schemaexport] SEVERE: Could not configure datastore from file: /home/user/eclipse/workspace/hibernate3/src/Person.hbm.xml
[schemaexport] org.hibernate.MappingException: class Person not found while looking for property: id
[schemaexport] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
[schemaexport] at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:275)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:360)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:294)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
[schemaexport] at org.hibernate.cfg.Configuration.add(Configuration.java:362)
[schemaexport] at org.hibernate.cfg.Configuration.addFile(Configuration.java:228)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[schemaexport] Caused by: java.lang.ClassNotFoundException: Person
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
[schemaexport] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
[schemaexport] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[schemaexport] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
[schemaexport] at java.lang.Class.forName0(Native Method)
[schemaexport] at java.lang.Class.forName(Class.java:141)
[schemaexport] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
[schemaexport] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
[schemaexport] ... 17 more
BUILD FAILED: /home/user/eclipse/workspace/hibernate3/build.xml:61: Schema text failed: Could not configure datastore from file: /home/user/eclipse/workspace/hibernate3/src/Person.hbm.xml
Total time: 1 second


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 7:42 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Post your hibernate.cfg.xml file.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 7:47 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
hibernate.cfg.xml
---------------------------------------------------------------------------------------
<?xml version='1.0' encoding='utf-8'?>
<!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.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:data/tutorial</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>


<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</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="Event.hbm.xml"/>
<mapping resource="Person.hbm.xml"/>
<mapping resource="Person.hbm.xml"/>

</session-factory>

</hibernate-configuration>

--------------------------------------------------------------------------------------
hibernate.properties
-------------------------------------------------------------------------------------------
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:data/tutorial
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.dialect=org.hibernate.dialect.HSQLDialect
--------------------------------------------------------------


Last edited by srinivasch on Mon Sep 25, 2006 10:08 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 7:50 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
hi,

Please ignore the ldap ( database connection configuration) in hibernate.cfg.xml file , we commented out that part.


Regards,
Srinivas


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 8:18 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Try removing the second mapping resource of Person.hbm.xml


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 8:37 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
hi,

We deleted the second 'Person-hbm.xml' from the 'hibernate.cfg.xml' .

Even then we r getting the following error:

we understood that it is taking the Person.hbm.xml refrence from the build.xml not from the hibernate.cfg.xml file.
---------------------------------------------------------------------------------------
Buildfile: /home/user/eclipse/workspace/hibernate3/build.xml
schemaexport:
[schemaexport] Oct 3, 2005 3:32:57 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: Hibernate 3.0.5
[schemaexport] Oct 3, 2005 3:32:57 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: hibernate.properties not found
[schemaexport] Oct 3, 2005 3:32:57 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using CGLIB reflection optimizer
[schemaexport] Oct 3, 2005 3:32:57 PM org.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using JDK 1.4 java.sql.Timestamp handling
[schemaexport] Oct 3, 2005 3:32:57 PM org.hibernate.cfg.Configuration addFile
[schemaexport] INFO: Mapping file: /home/user/eclipse/workspace/hibernate3/src/Person.hbm.xml
[schemaexport] Oct 3, 2005 3:32:58 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
[schemaexport] INFO: Mapping class: Person -> PERSON
[schemaexport] Oct 3, 2005 3:32:58 PM org.hibernate.cfg.Configuration add
[schemaexport] SEVERE: Could not compile the mapping document
[schemaexport] org.hibernate.MappingException: class Person not found while looking for property: id
[schemaexport] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
[schemaexport] at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:275)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:360)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:294)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
[schemaexport] at org.hibernate.cfg.Configuration.add(Configuration.java:362)
[schemaexport] at org.hibernate.cfg.Configuration.addFile(Configuration.java:228)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[schemaexport] Caused by: java.lang.ClassNotFoundException: Person
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
[schemaexport] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
[schemaexport] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[schemaexport] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
[schemaexport] at java.lang.Class.forName0(Native Method)
[schemaexport] at java.lang.Class.forName(Class.java:141)
[schemaexport] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
[schemaexport] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
[schemaexport] ... 17 more
[schemaexport] Oct 3, 2005 3:32:58 PM org.hibernate.cfg.Configuration addFile
[schemaexport] SEVERE: Could not configure datastore from file: /home/user/eclipse/workspace/hibernate3/src/Person.hbm.xml
[schemaexport] org.hibernate.MappingException: class Person not found while looking for property: id
[schemaexport] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
[schemaexport] at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:275)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:360)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:294)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
[schemaexport] at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
[schemaexport] at org.hibernate.cfg.Configuration.add(Configuration.java:362)
[schemaexport] at org.hibernate.cfg.Configuration.addFile(Configuration.java:228)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[schemaexport] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[schemaexport] Caused by: java.lang.ClassNotFoundException: Person
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
[schemaexport] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
[schemaexport] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
[schemaexport] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[schemaexport] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
[schemaexport] at java.lang.Class.forName0(Native Method)
[schemaexport] at java.lang.Class.forName(Class.java:141)
[schemaexport] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
[schemaexport] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
[schemaexport] ... 17 more
BUILD FAILED: /home/user/eclipse/workspace/hibernate3/build.xml:62: Schema text failed: Could not configure datastore from file: /home/user/eclipse/workspace/hibernate3/src/Person.hbm.xml
Total time: 1 second
-------------------------------------------------------------------------------------

hibernate.cfg.xml
-----------------------------------------------------------------------------------------

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!-- Database connection settings
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:data/tutorial</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>


<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</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="Event.hbm.xml"/>
<mapping resource="Person.hbm.xml"/>


</session-factory>

</hibernate-configuration>
--------------------------------------------------------------------------------------
build file:
------------------------------------------------------------------------------------
<project name="hibernate-tutorial" default="compile">

<property name="basedir" value="/home/user/eclipse/workspace/hibernate3"/>
<property name="sourcedir" value="${basedir}/src"/>
<property name="targetdir" value="${basedir}/bin"/>
<property name="librarydir" value="${basedir}/lib"/>
<property name="class.path" value="${basedir}/bin"/>

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

</fileset>
<fileset dir="${librarydir}">
<include name="*.jar"/>
</fileset>

</path>

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

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

<target name="copy-resources">
<copy todir="${targetdir}">
<fileset dir="${sourcedir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="run" depends="compile">
<echo message="Compiling to run the application"/>
<java fork="true" classname="EventManager" classpathref="libraries">
<classpath path="${targetdir}"/>
<arg value="${action}"/>
</java>
</target>
<target name="schemaexport">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="classes.path">
</taskdef>

<schemaexport
properties="/home/user/eclipse/workspace/hibernate3/hibernate.properties"
quiet="no"
text="no"
drop="no"
delimiter=";"
output="schema-export.sql">
<fileset dir="src">
<include name="Person.hbm.xml"/>
</fileset>
</schemaexport>
</target>

</project>
<project name="hibernate-tutorial" default="compile">

<property name="basedir" value="/home/user/eclipse/workspace/hibernate3"/>
<property name="sourcedir" value="${basedir}/src"/>
<property name="targetdir" value="${basedir}/bin"/>
<property name="librarydir" value="${basedir}/lib"/>
<property name="class.path" value="${basedir}/bin"/>

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

</fileset>
<fileset dir="${librarydir}">
<include name="*.jar"/>
</fileset>

</path>

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

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

<target name="copy-resources">
<copy todir="${targetdir}">
<fileset dir="${sourcedir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="run" depends="compile">
<echo message="Compiling to run the application"/>
<java fork="true" classname="EventManager" classpathref="libraries">
<classpath path="${targetdir}"/>
<arg value="${action}"/>
</java>
</target>
<target name="schemaexport">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="classes.path">
</taskdef>

<schemaexport
properties="/home/user/eclipse/workspace/hibernate3/hibernate.properties"
quiet="no"
text="no"
drop="no"
delimiter=";"
output="schema-export.sql">
<fileset dir="src">
<include name="Person.hbm.xml"/>
</fileset>
</schemaexport>
</target>

</project>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 8:49 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
What does your hibernate.properties look like?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 8:57 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
my hibernate.properies
----------------------------------------------------------------------------------------

hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:data/tutorial
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.dialect=org.hibernate.dialect.HSQLDialect


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 5:43 pm 
Regular
Regular

Joined: Fri Sep 09, 2005 11:35 am
Posts: 101
your classpath for schemaexport is not correct.
try adding the class dir to the classpath


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 1:52 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
hi,

Thank you for your support.

I am setting the classpath for the java classes as follows. Pls help me I am working on this for the last 4 days.
--------------------------------------------------------------------------------------
This directory contains all *.class files

<property name="class.path" value="${basedir}/bin"/>
-------------------------------------------------------------------------------------
Setting the referrences to the *.class files directory & hibernate *.jar files

<path id="[color=red]classes.path[/color]">
<fileset dir="${class.path}">
<include name="*.class"/>
</fileset>
<fileset dir="${librarydir}">
<include name="*.jar"/>
</fileset>
</path>
------------------------------------------------------------------------------------

In the build file , I have given the above class referrence as follows

<target name="schemaexport">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="[color=red]classes.path[/color]">
</taskdef>

<schemaexport


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 2:41 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
hi,

We are able to generate schema successfully with schemaExport.

Thank you very much for your support


Regards,
Srinivas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 9:53 am 
Regular
Regular

Joined: Fri Sep 09, 2005 11:35 am
Posts: 101
Quote:
<path id="classes.path">
<fileset dir="${class.path}">
<include name="*.class"/>
</fileset>
<fileset dir="${librarydir}">
<include name="*.jar"/>
</fileset>
</path>


i think this is incorrect in ur classpath
Code:
<fileset dir="${class.path}">
<include name="*.class"/>
</fileset>

it should be
Code:
<pathelement location="${class.path}"/>


if a posting helped you should rate it also.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 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.