-->
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.  [ 3 posts ] 
Author Message
 Post subject: can hibernate create table at runtime
PostPosted: Fri Mar 28, 2008 2:01 am 
Newbie

Joined: Fri Mar 28, 2008 1:53 am
Posts: 1
hi,
I have been wondering about this for a while now.
basicly i wanna to have a dynamic website which hands everything
to the front view including create of a table in database.

i know without Hibernate and Spring it is possible but it's a lot of work.

i have been searching for resources in everything way but no Luck.

please lead me to the right source.

Sincerely.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 28, 2008 4:15 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
you can create/manipulate a Configuration by Code and create a SessionFactory from it, including schema creation if you want.

But since the SessionFactory is logical immutable you'll have to drop and recreate SessionFactories, or work with multiple SessionFactories, which will cause some very special challanges for sure.

Jens

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 28, 2008 5:02 pm 
Newbie

Joined: Fri Mar 21, 2008 2:20 pm
Posts: 10
Location: London
In JPA you would just use multiple persistence units, and create one EntityManagerFactory per persistence unit/database.

Then, when calling EntityManagerFactory.createEntityManager() you would pass in a Properties instance that you would build dynamically, and set the hibernate.connection.url property to the URL of your newly created database.

And how to create the database? Just use JDBC and execute your create database statement, and then schema DDL statements.

Andy.

_________________
http:// www.techfoundry.com


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