-->
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.  [ 4 posts ] 
Author Message
 Post subject: database creation
PostPosted: Thu Apr 17, 2008 6:11 pm 
Newbie

Joined: Thu Apr 17, 2008 6:02 pm
Posts: 3
Hibernate version:
3.2.1.ga

Hi to all

Is possible to create / drop a database using Hibernate?.

I mean using pure Hibernate API from a Java application.

Any help is very appreciated.

Thank you very much.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 18, 2008 12:45 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Hibernate tools can help you do that. You can invoke hbm2ddl hibernate tool at runtime and do a schema export. But doing that in runtime, I don't know how safe it is. You should read the hibernate tools guide for further details. If you have further queries on hibernate tools, you should post it on the tools forum

_________________
Sukirtha


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 18, 2008 5:58 pm 
Newbie

Joined: Thu Apr 17, 2008 6:02 pm
Posts: 3
Thank you for the reply.

I'm using the class org.hibernate.tool.hbm2ddl.SchemaExport

The method schemaExport.create(...); allows to create the DB schema, in other words, create the tables, constraints, keys, etc.

But it doesn't create the DB itself.

If the DB doesn't exist, it produces an exception.

Am I missing something?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 21, 2008 12:07 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
I don't think it creates the DB itself. But I am not very sure. You should be able to get help on the tools forum. You will find hibernate tools experts in that forum.

_________________
Sukirtha


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.