-->
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: Initializing database
PostPosted: Mon Apr 02, 2007 8:14 am 
Beginner
Beginner

Joined: Mon Apr 02, 2007 8:08 am
Posts: 24
I'm mapping some classes with Hibernate and I'd like to delegate both data model creation and data initialization to Hibernate. Is it possible?

In other words, is is possible to populate the initial data of the database in the very beginning of hibernate bootup?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 03, 2007 7:16 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
The database creation can be done with hbm2ddl.auto set to create or create-update

For data initialization, this is business work, just creating objects and saving them. You can use hibernate xml features to specify your data as xml file.

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 03, 2007 7:22 am 
Beginner
Beginner

Joined: Mon Apr 02, 2007 8:08 am
Posts: 24
scesbron wrote:
(...)For data initialization, this is business work, just creating objects and saving them. You can use hibernate xml features to specify your data as xml file.


It's "bussiness layer business" :). You're so right I'm populating the database at the startup, saving constants with Spring.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 09, 2007 9:52 am 
Newbie

Joined: Fri Nov 09, 2007 9:45 am
Posts: 2
"For data initialization, this is business work, just creating objects and saving them. You can use hibernate xml features to specify your data as xml file."

So does that mean that if I setup my data as xml, it will get inserted into the appropriate tables when hibernate creates the tables on the first run?

Can you please point me to instructions or examples for doing that.


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.