-->
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.  [ 6 posts ] 
Author Message
 Post subject: SchemaExport: insert initial objects?
PostPosted: Sat Feb 21, 2004 4:11 am 
Newbie

Joined: Fri Feb 20, 2004 7:37 am
Posts: 12
Hi,

I'm fairly new to hibernate but after some trial time I'm now generating the hibernate mapping files with XDoclet and let SchemaExport translating them to a DDL-file.
My question: Is is possible to define initial objects which will lead to insert-statements initializing the DB-tables with start-off records?

Thanks for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 21, 2004 6:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Not with builtin functionality. It should be fairly easy however to write a little program which just creates a Hibernate instance, and inserts your objects. Just integrate it into your build/install process.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 21, 2004 2:33 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I'm not certain exactly what you are asking for. Is this a usecase for the replicate() method?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 21, 2004 6:58 pm 
Newbie

Joined: Fri Feb 20, 2004 7:37 am
Posts: 12
A simple usecase is an user object (-> user table) to manage the accounts for my system.
I'd like to have some predefined, initial accounts (e.g. administrator, guest, ...) which will be written to the database during installation / configuration.

A small program doing this is fine with me.

If there is no Hibernate build in feature at the moment: wouldn't it be a nice idea for a future release?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 21, 2004 7:41 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Don't think so. You can just as easily insert that yourself using hibernate or execute an SQL script. How should Hibernate make that easier?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 22, 2004 1:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
There are tools around that specialise in this sort of thing. I have tended to use dbUnit for prepopulating a database with values during the testing phases. See [url]dbunit.sf.net[/url].


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