File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
Object Relational Mapping
Hibernate: Generate the DDl to a output file using the update=true in hbm2ddl tool
Joined: Aug 18, 2011
Oct 07, 2011 17:42:59
I am trying to export the generated DDL to a output file instead of directly showing in command prompt for hbm2ddl.auto=update(using automatic schema generation).
I know this may not be good idea to generate the schema using this for production database. I have already gone thru several threads that talk about it.
I am trying to use this for development/test databases.
But, the challenge I am facing here is it's not sending out the generated DDL to a output file even though I am using the "outputfilename" attribute in hbm2ddl
exporter. (as per this
Here is how my build.xml looks like. I am using the Hibernate's Jpa configuration.
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="classpath.hibernate" />
<target name="db_update_schema_sql" depends="db_config" description="create SQL script for updating schema">
<hbm2ddl export="false" create="false" update="true" drop="false" outputfilename="update.sql" delimiter=";" format="true"/>
<target name="db_full_update" depends="db_config" description="Updates database">
<antcall target="db_update_schema_sql" />
The "update.sql" is never created/updated when I set the update="true". It only creates/update when I use either create="true" or drop="true" or both.
I digged little bit into this. I found couple of issues related to this in Hibernate Jira. It still says it's unresolved. There is a patch available for this. Not sure
whether someone used this patch.
I would really appreciate if someone using this update="true" feature to generate the ddl directly to a file explain to me how they have done it.
Also, if you use the patch for this, can you let me know how you applied the patch to the existing Jar file.
Joined: May 16, 2005
Oct 10, 2011 03:30:13
Not worked this specific, but a dirty solution would be to output the console to a file. Can you try this?
C:\Users\arunkumarr> build.xml >> myLog.txt
C:\Users\arunkumarr> build.xml > myLog.txt
If you are not laughing at yourself, then you just didn't get the joke.
I agree. Here's the link:
subject: Hibernate: Generate the DDl to a output file using the update=true in hbm2ddl tool
Hibernate tool problem.
Facing problem in Schema export
Where to see output of hbm2ddl?
HSQLDB - user lacks privilege or object not found
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015