If Hibernate is auto generating the DDL why not just remove the script:
<jdbc:embedded-database id="dataSource" >
<jdbc:script location="classpath:sql/testData.sql"/>
</jdbc:embedded-database>
Pregunta
For testing my application I wrotte a special application-context-test.xml I want use an internal hsqldb as data source like this :
<jdbc:embedded-database id="dataSource" >
<jdbc:script location="classpath:sql/init.sql" />
<jdbc:script location="classpath:sql/testData.sql"/>
</jdbc:embedded-database>
the init.sql is generated by hibernate3-maven-plugin and start with some drop constraint and table like this :
alter table t_menu
drop constraint fk_menu_menu;
So when the init.sql is loaded it fails of course with the error :
Caused by: java.sql.SQLException: Table not found: T_MENU in statement [alter table t_menu]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
I could make a special initTest.sql script with no drop, but I would have to keep it up to date manually each time the schema change.
Is there any option to tell hsql to keep executing the script on error ?
thanks !
Solución 2
If Hibernate is auto generating the DDL why not just remove the script:
<jdbc:embedded-database id="dataSource" >
<jdbc:script location="classpath:sql/testData.sql"/>
</jdbc:embedded-database>
Otros consejos
For my initial question I found a way to ignore failure like this :
<jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
<jdbc:script location="classpath:sql/init.sql"/>
<jdbc:script location="classpath:sql/testData.sql"/>
</jdbc:initialize-database>
<jdbc:embedded-database id="dataSource" type="HSQL">