wood burning stoves*
The moose likes Object Relational Mapping and the fly likes Hibernate: Creating new database using hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate: Creating new database using hibernate" Watch "Hibernate: Creating new database using hibernate" New topic
Author

Hibernate: Creating new database using hibernate

Raj Purohit
Greenhorn

Joined: Sep 26, 2007
Posts: 10
Hi,
I am currently developing a admin console for my project. For that I am required to create databases and tables in that databases. I am using JavaServerFaces with Hibernate to achieve the task. My problem is that I can't find a way to create databases using hibernate. As I have read, I can certainly create tables in the (already created) database using SchemaExport utility, but I didn't find any material to create database using hibernate. Please help!!!
-Raj
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

Using SQLQuery objects you should be able to pass DDL statements through Hibernate to the database, or you can get the JDBC connection directly from your Session object, or just use straight JDBC.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Angel J Gama
Ranch Hand

Joined: Jun 28, 2007
Posts: 36
You're right Raj, Hibernate just creates tables over an existing database. If you need to create the database too, you should think on a work around, may be call a stored procedure from your DBA, do it manually or something like that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate: Creating new database using hibernate