-
1. Re: import.sql
nickarls Mar 3, 2008 10:23 AM (in response to marx3)
Marek Nazarko wrote on Mar 03, 2008 09:54 AM:
There is possibility to execute import.sql script, but only on startup and only ifcreate
is set in persistance.xml
I would like to manually execute other script from my application.
How can I do that?
Not tried but:
You should be able to dig out a JDBC connection from the entityManger delegate (or lookup it in JNDI), parse the script and run the statements yourself.
-
2. Re: import.sql
marx3 Mar 3, 2008 10:37 AM (in response to marx3)It's hard way, and I did it, but I'm looking for an easy way. I'm sure it's possible, but I need an example.
-
3. Re: import.sql
nickarls Mar 3, 2008 11:13 AM (in response to marx3)My final offer: aquire resource, put it through BufferedReader.readLine() and pass it along to the entityManager.createNativeQuery() ;-)
I would be surprised if there was an API for running a native script but feel free to surprise me...
-
4. Re: import.sql
marx3 Mar 3, 2008 11:52 AM (in response to marx3)Seam has something.
Import.sql file is used in Seam only, and Seam executes it after schema is generated. I suspect it uses some sort of Observer to execute it just then.
I want to do something similair (for example, I want to execute script even ifupdate
is set in persistence.xml) -
5. Re: import.sql
nickarls Mar 3, 2008 12:03 PM (in response to marx3)
Marek Nazarko wrote on Mar 03, 2008 11:52 AM:
Seam has something.
Import.sql file is used in Seam only, and Seam executes it after schema is generated. I suspect it uses some sort of Observer to execute it just then.
I think import.sql is more a hibernate-thing than a seam-thing. looking through the source code would probably reveal how the import is done (and can you access the API)
-
6. Re: import.sql
marx3 Mar 5, 2008 10:25 AM (in response to marx3)I've gave up. Now I simply want to use import.sql as intended. I simply put there
execute my_procedure
and I get java.sql.SQLSyntaxErrorException: ORA-00900:
-
7. Re: import.sql
balazska Apr 26, 2009 8:03 PM (in response to marx3)Hi!
The problem was solved?
thx