• Problem generating table scripts

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #7356  by cinto_qq
 
Hi,

I have tried to follow the script in http://wiki.openkm.com/index.php/Using_ ... _databases to generate the database scripts, but is not able to do so.

I have some questions about the script:

1) Where do I place the script?
2) Where is hibernate.cfg.xml found?
3) What other jar files do I need? I have added hibernate3.jar, all the slf4j-*.jars and javaassist.jar.

Is there any other way to get the schema?

Thanks.


Cinto
 #7366  by cinto_qq
 
Hi Pavila,

I would like to switch the database to mysql, and I am also interested in knowing the table structures.


Cinto
 #7400  by pavila
 
But, is the automatic table creation is not working for you? Yo can configure to generate the tables in MySQL if you want. I don't know why you need to generate the script, but is easy:
Code: Select all
Configuration cfg = new Configuration();
cfg.configure(new File("/path/to/hibernate.cfg.xml"));
SchemaExport se = new SchemaExport(cfg);
se.setOutputFile("/path/to/Escritorio/schema.sql");
se.setFormat(true);
se.create(false, false);
 #7420  by cinto_qq
 
Hi Pavila,

I am using this code, but I keep getting errors, like cannot find "/path/to/hibernate.cfg.xml", and missing classes.

Where do I place this table creation script?


Cinto
 #7660  by Sether
 
I'd also like to be able to create the sql creation schema file, and want to know where to find the hibernate.cfg.xml file.

I haven't tried the automatic creation program, but I'd MUCH rather have a script file that I can review and execute myself than let a program go and just create objects on my database willy-nilly.

My assumption here is that hibernate.cfg.xml is the input file that's then translated into the .sql file, and I can then run the sql file against my database and create the schema.
 #7667  by jllort
 
obviously if in your system there's no the file path "/path/to/hibernate.cfg.xml" you'll get that error, you must replace that path for a valid path to the hibernate.cfg.xml in your OS and same for the output file, some valid folder path to output script
 #7700  by Sether
 
I found the answer on my own. For anyone reading this in the future, the hibernate.cfg.xml file in packed inside the OpenKM.war file in the server/default/deploy directory. Essentially all the dependencies are in this war file. If you include the classes directory inside WEB-INF and all the jars in the lib directory in WEB-INF in your classpath, you should be able to compile and run the included code.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.