-->
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.  [ 2 posts ] 
Author Message
 Post subject: Schemaexport Ant task generates only "drop" sql
PostPosted: Mon Jul 05, 2004 12:01 pm 
Newbie

Joined: Mon Jul 05, 2004 11:49 am
Posts: 4
Location: Italy
Hi,I'm working on a project and I'm trying to use Hibernate, Ant and Schemaexport.

My develop tree is as follow

/build.xml
/src
/pack1
/packa
pojo.java
pojo2.java
/build
/pack1
/packa
pojo.class
pojo2.class
pojo.hbm.xml
pojo2.hbm.xml

I successfully generated the .hbm.xml with the hibernatedoclet ant task.

Then I try to generate the sql script to create the db...

This is my build.xml

<project name="MyProject" default="dist" basedir=".">

[...]

<!-- task definition for schemaexport to automatically generate sql scripts from hibernate .xml files -->
<taskdef name="schemaexport"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask">
<classpath>
<!-- this is needed to make shemaexport able
to find compile classes -->
<pathelement path="${build}"/>
<fileset dir="${lib.ant}/hibernate">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>

[...]

<target name="initdb">
<schemaexport drop="true"
output="schema.sql"
properties="${src}/config/hibernate.properties"
quiet="no"
text="yes">
<fileset dir="${build}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>

[...]

when I run the task a file "schema.sql" is generated but it contains only the drop instructions...

---------------------------
drop table Pojo
drop sequence hibernate_sequence
---------------------------

But there are no "create table" sql...

Do you know how it is possible and how can I solve this problem ?

thanks

Dani


Top
 Profile  
 
 Post subject: the solutions is easy
PostPosted: Mon Jul 05, 2004 12:09 pm 
Newbie

Joined: Mon Jul 05, 2004 11:49 am
Posts: 4
Location: Italy
The problem lies on this task

Quote:
<target name="initdb">
<schemaexport drop="true"
output="schema.sql"
properties="${src}/config/hibernate.properties"
quiet="no"
text="yes">
<fileset dir="${build}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>


If I include drop="true" only the drop sql are generated.
Removing drop="true" all create tables are correctly generated


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