-->
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.  [ 2 posts ] 
Author Message
 Post subject: How do I determine if tables have already been created in DB
PostPosted: Mon Oct 24, 2005 3:07 pm 
Newbie

Joined: Mon Oct 24, 2005 2:56 pm
Posts: 1
How do I determine if the tables defined in the hibernate.cfg.xml file have already been created in the database?

Here are the requirements that necessitate this:
I need to write a Java program that reads the hibernate.cfg.xml, checks if the tables defined there exist in the DB; create the tables only if they do not already exist.

Due to some restrictions in our project, we cannot use the ant tool for this purpose; hence the need for a custom program that internally does make use of the SchemaExport class.

Any help is greatly appreciated.

Hibernate version: 3.0.2

Name and version of the database you are using: Postgres 8.0, Oracle 10g


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 24, 2005 4:54 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
grab jdbc connection from hibernate Configuration and call DatabaseMetadata#getTables


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

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.