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!!!
|
|