-->
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: exporting schema automatically using hibernatetool
PostPosted: Mon Jan 07, 2013 12:11 pm 
Newbie

Joined: Sun Dec 30, 2012 12:44 pm
Posts: 4
Hi i am just trying to create the table directly through mapping classes in hibernate.

i need to set the property <hibernate.hbm2ddl.auto> to "create-drop" in my hibernate.cfg.xml file.

But my requirement is i dont want to drop and reacreate the table every time i start the application which is happening in the above case. so i set my <hibernate.hbm2ddl.auto> to "validate".

IT is working fine when i am not using any build tool.
Now when i am building the project through Ant i am not able to get away with that "drop and create thing everytime i am restarting the application"

Please find below my configuration and build file code which i am using to create the schema:

hibernate.hbm.xml

<hibernate-configuration>
<session-factory>

<!-- difining the dialect of the hibernate-->


<property name="hibernate.hbm2ddl.auto">
validate
</property>

<property name="hibernate.dialect">
org.hibernate.dialect.OracleDialect
</property>

<!-- difining the driver class for the databse-->

so on ..


build.xml


<!--creating the database schema automatically -->

<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="project.classpath"/>
<target name="schemaexport" depends="compile, copymetafiles" description="Exports a generated schema to DB and file">
<hibernatetool destdir="${basedir}">
<classpath path="${build.dir}"/>
<configuration configurationfile="${build.dir}/hibernate.cfg.xml"/>
<hbm2ddl
drop="false"
create="false"
export="true"
outputfilename="MoneyManagement-ddl.sql"
delimiter=";"
format="true"/>

</hibernatetool>
</target>


i am really stuck in this done lots of browsing and all ..there is no validate option in hibernatetool task define using ant.

Any help on this will be appreciated!!!


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.