Script - Generate database script

Generates the database schema present at hibernate.cfg.xml file.

The hibernate.cfg.xml schema file only contains jBPM database structure.

You can find the DDL SQL sentences for table creation for several databases at Jbpm-ddl-3.3.1.zip.

import java.io.File;
 
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

Configuration cfg = new Configuration();
cfg.configure(new File("/desarrollo/tomcat/tomcat-7.0.27-openkm-6.3/webapps/OpenKM/WEB-INF/classes/hibernate.cfg.xml"));
SchemaExport se = new SchemaExport(cfg);
se.setOutputFile("/home/openkm/schema.sql");
se.setFormat(true);
se.create(false, false); 

See also: