-->
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: Standard inserts
PostPosted: Wed Feb 18, 2009 6:46 pm 
Newbie

Joined: Fri Jan 18, 2008 3:43 pm
Posts: 9
Is there an equivalent in Hibernate to do standard inserts when creating a database?

For example in MySQL Workbench you're able to design the database tables and define some standard inserts in them that are required for an application to work.

Is there a way to do this in Hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2009 12:51 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
I dont think anythng like tht is existing... but you can always do this is the DB initialization code.

_________________
Regards,
Litty Preeth


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2009 5:07 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
You can include an import.sql in your classpath, which will be imported if the schema is created by hibernate (hbm2ddl.auto should be 'create').

Look here: http://www.hibernate.org/381.html

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject: Re: Standard inserts
PostPosted: Fri May 29, 2009 5:19 pm 
Newbie

Joined: Fri Jan 18, 2008 3:43 pm
Posts: 9
Thanks a lot! That worked like a charm. Is there a way to delete this file after the initial import? I don't want this to happen more than once.


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.