-
1. Re: Simple question about sample apps with Seam
saeediqbal1 Apr 13, 2007 2:32 PM (in response to smithbstl)Exactly what was on my list to find out today. I moved the stuff to point to mysql so i wanted to avoid the application calling import.sql and dropping tables in the begining.
I did a project search in eclipse to find import.sql string in any file but it failed with no results -
2. Re: Simple question about sample apps with Seam
saeediqbal1 Apr 13, 2007 2:34 PM (in response to smithbstl)I guess i found somewhat here . when you run seam-gen you also see
[input] Do you want to drop and recreate the database tables and data in import.sql each time you deploy? [n] (y,n,)
n -
3. Re: Simple question about sample apps with Seam
smithbstl Apr 13, 2007 2:40 PM (in response to smithbstl)I have been googleing and found a few mentions of here and there in the context of Seam. Based on what I have found it looks like a Hibernate convenience to load the data. It must be deployed with the ejb jar and must be called import.sql
There is some mention of it here but none of these mention any configuration invloded so I guess there is none
http://www.michaelyuan.com/blog/2006/11/29/official-seam-demo-app-for-glassfish/
http://dltj.org/2007/01/drc-ir-ejb3-seam/
EDIT while conposing this:
I found it in Hibernate docs
http://www.hibernate.org/381.htmlAlso note that since Hibernate 3.1 you can include a file called "import.sql" in the runtime classpath of Hibernate. At the time of schema export it will execute the SQL statements contained in that file after the schema has been exported.
One problem that exists at least until 3.1.2 is that if you have any "error" in your custom sqls the generation will fail. This makes it impossible to safely drop sequences or indexes before you create them in that file. That is because either you only "create" your stuff which will fail the second time or you "drop" and "create" which will fail the first time since there is nothing to drop. -
4. Re: Simple question about sample apps with Seam
saeediqbal1 Apr 13, 2007 2:46 PM (in response to smithbstl)Thanks for the info. Can we have an existing project that has import.sql for example dvd store .. and we make it an empty file in order to avoid database creation/deletion. would the application complain?
-
5. Re: Simple question about sample apps with Seam
smithbstl Apr 13, 2007 2:51 PM (in response to smithbstl)Just don't include the import.sql file in the classpath. I have a project that i created not using Seam-Gen so there was no import file - thats why i didn't know if there was any configuration involved to start using one. I think the sample apps would run ok without data, just would not be very useful.
-
6. Re: Simple question about sample apps with Seam
mrobinson28 Apr 13, 2007 4:14 PM (in response to smithbstl)I think this pretty much sums up how the import script is executed:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=89473 -
7. Re: Simple question about sample apps with Seam
smithbstl Apr 13, 2007 5:21 PM (in response to smithbstl)LOL, that does clear it up nicely, thanks
-
8. Re: Simple question about sample apps with Seam
saeediqbal1 Apr 13, 2007 6:56 PM (in response to smithbstl)i am going to have a blank import.sql file once the objects are created in the database.