-->
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.  [ 6 posts ] 
Author Message
 Post subject: schema export hibernate 3
PostPosted: Wed Feb 21, 2007 6:01 am 
Beginner
Beginner

Joined: Wed Jan 31, 2007 11:39 am
Posts: 24
In my build.xml I had the following target so as to create a schema in a specific sql file and it worked.


<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="schema.classpath"/>
<target name="schema">
<schemaexport
quiet="no" text="true" drop="no" delimiter=";"
output="schema-export.sql"
config="build/WEB-INF/classes/hibernate.cfg.xml"> </schemaexport>
</target>


Because I am using Hibernate 3 I decided to use the hibernate tools to create the schema so I created the following target:

<taskdef name="schemaexportHibernate3task" classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="schema.classpath"/
<target name="schemaExportHibernate3">
<hibernatetool destdir=".">
<configuration configurationfile="build/WEB-INF/classes/hibernate.cfg.xml"/>
<hbm2ddl outputfilename="schema-export.ddl" export="false"/>
</hibernatetool>
</target>


However this target is not working and says that it cannot find my *.hbm.xml files. Moreover why do I need a destdir in hibernatetool since I only want to fill the schema-export.ddl and not to generate any other file?

Any clue?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 21, 2007 7:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
1) what is so bad about wanting a destdir ?

2) did you put your hbm.xml on the classpath so the resources you most likely specified in your hibernate.cfg.xml can be found ?

3) the tools forum is a better place for these kind of questions ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 21, 2007 7:36 am 
Beginner
Beginner

Joined: Wed Jan 31, 2007 11:39 am
Posts: 24
Quote:
1) what is so bad about wanting a destdir ?


It is not bad, I just do not understand its use?What is it going to be created there?

Quote:
2) did you put your hbm.xml on the classpath so the resources you most likely specified in your hibernate.cfg.xml can be found ?



Yes I did that is why I enclose the previous target that was working to show that the classpath is ok.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 21, 2007 8:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
juanita wrote:
Quote:
1) what is so bad about wanting a destdir ?


It is not bad, I just do not understand its use?What is it going to be created there?


schema-export.sql for one.

Quote:
Quote:
2) did you put your hbm.xml on the classpath so the resources you most likely specified in your hibernate.cfg.xml can be found ?



Yes I did that is why I enclose the previous target that was working to show that the classpath is ok.

[/quote]

You should put your hibernate project related classpaths inside the hibernatetool/configuration task - not in the taskdef.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 21, 2007 8:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
max wrote:
juanita wrote:
Quote:
1) what is so bad about wanting a destdir ?


It is not bad, I just do not understand its use?What is it going to be created there?


schema-export.sql for one.


btw. afaik it should only complain about it if its actually needed ....which it is in this case since you put schema-export.sql there

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 21, 2007 8:56 am 
Beginner
Beginner

Joined: Wed Jan 31, 2007 11:39 am
Posts: 24
Indeed the problem was that I did not include the classpath in the hibernatetool. As far as the destdir is concerned I was asking because I thought that it was enough the outputfilename="schema-export.ddl" to define the location of the ddl, but yes destdir is mandatory.

Thank you very much for your answers.


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