These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: SchemaUpdate - How to stop script execution into DB
PostPosted: Tue May 03, 2011 6:37 am 
Newbie

Joined: Tue Apr 26, 2011 3:19 am
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.