I am working on small hibernate project.
Requirement ----------------- 1. If table does not exists then it should generate CREATE TABLE SCRIPT 2. If table exists and there is change in mapping file then it should generate ALTER TABLE SCRIPT 3. If table exists and no change in mapping file then it should throw exception
But none of the scripts shoud be executed into the DB.
Used Hibernate API ------------------------ SchemaUpdate
schemaUpdate = new SchemaUpdate(annotationConfiguration); schemaUpdate.setOutputFile("D:/" + file.getName()); schemaUpdate.setFormat(true);
schemaUpdate.execute(true, true); // script = true and doUpdate = true. When I make doUpdate = false then Hibernate always generates the CREATE TABLE SCRIPT
schemaUpdate.setDelimiter(";");
Problem ------------ The scripts are generated but at the same time getting executed on DB, which is not desirable. I just want to access DB to check whether the table exists or not and depending on that scripts (CREATE or ALTER TABLE SCRIPT) should be generated but should not be executed into the DB.
Thank you.
_________________ Vinay
|