-->
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: import.sql
PostPosted: Tue Sep 01, 2009 10:45 pm 
Beginner
Beginner

Joined: Thu Feb 21, 2008 3:31 pm
Posts: 34
Hi all,

If I wanted to split my import.sql into multiple files and still have that run on startup, how would I go about doing that? My import.sql is getting a little large and I was hoping I could maybe leave it in the same place and have one for each jar file that provides some functionality my web app is using. Alternatively, if it grows really large, I'd like to be able to specify a list of files to scan.

I am using JBoss Seam for my application framework.


Thanks,
Walter


Top
 Profile  
 
 Post subject: Re: import.sql
PostPosted: Fri Sep 04, 2009 6:35 am 
Beginner
Beginner

Joined: Wed Nov 19, 2008 6:39 am
Posts: 44
Location: Mumbai, India
you can do this with @<path>\b.sql at the end of import.sql file.

Let we have import.sql,a.sql and b.sql

write like this

import.sql
...
..
@\mysql\a.sql


a.sql:
...
..
@\mysql\b.sql

_________________
Thx,
Murugesan.
Web: http://www.murugesanpitchandi.com


Top
 Profile  
 
 Post subject: Re: import.sql
PostPosted: Fri Sep 04, 2009 6:48 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://www.seamframework.org/Documentation/ImportingDBUnitDatasetsForDevelopmentDeployments

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: Re: import.sql
PostPosted: Sat Sep 05, 2009 12:28 am 
Beginner
Beginner

Joined: Thu Feb 21, 2008 3:31 pm
Posts: 34
Christian,

That is perfect - there is a little bit of work I have to do, but so far it looks promising. The other suggestion is valid if I'm running it through MySQL Query Browser or command line probably, but for this task, it won't work.

The solution that I'm implementing is finding all occurrences of database.configuration through getResources( ... ). Then for the entries that are in an archive, I have to use Java's support for reading Zip files. Once I locate all the files and read all the content, I prioritize the SQL files based on the priority configured in database.configuration so if a script in one jar needs to run before another, it will. After they're all sorted out, I begin running them through entityManager.createNativeQuery( ... ).executeUpdate();



Walter


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.