Reputation: 161
I found this documentation http://docs.jboss.org/hibernate/core/4.0/manual/en-US/html/toolsetguide.html#toolsetguide-s1-3 saying that we can run SchemaExport using command line
java -cp hibernate_classpaths org.hibernate.tool.hbm2ddl.SchemaExport options mapping_files
Can someone please provide an example of how this is used? What is the format of the classpath (perhaps a example classpath), how do I do it with a hbm.xml mapping?
Thanks
Upvotes: 1
Views: 3484
Reputation: 105
Not a problem :) Example:
java -cp "hibernate/*" org.hibernate.tool.hbm2ddl.SchemaExport --properties=hibernate.properties --text Person.hbm.xml User.hbm.xml
Here "hibernate/*" means that you have a folder named "hibernate" with all libraries for hibernate (incl. hibernate3 of course).
in my case:
You have to put in the current folder the file hibernate.properties (you can use hibernate.cfg.xml, but option will be --config instead of --properties. I.e. "--config=hibernate.cfg.xml")
--text - output to the console Next a list of necessary files *.hbm.xml.
That's all.
Upvotes: 1