{
// EntityStore Data
{
UnitOfWork uow = persistenceModule.newUnitOfWork();
try {
SQLConfiguration config = uow.get( SQLConfiguration.class,
PostgreSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
Connection connection = persistenceModule.findService( DataSource.class ).get().getConnection();
connection.setAutoCommit( false );
connection.setReadOnly( false );
String schemaName = config.schemaName().get();
if ( schemaName == null ) {
schemaName = SQLs.DEFAULT_SCHEMA_NAME;
}
Statement stmt = null;
try {
stmt = connection.createStatement();
stmt.execute( "DROP SCHEMA " + schemaName + " CASCADE" );
connection.commit();
} finally {
SQLUtil.closeQuietly( stmt );
}
} finally {
uow.discard();
}
}
// Indexing Data
{
UnitOfWork uow = persistenceModule.newUnitOfWork();
try {
SQLConfiguration config = uow.get( SQLConfiguration.class, PostgreSQLIndexQueryAssembler.DEFAULT_IDENTITY );
Connection connection = persistenceModule.findService( DataSource.class ).get().getConnection();
connection.setAutoCommit( false );
connection.setReadOnly( false );
String schemaName = config.schemaName().get();
if ( schemaName == null ) {
schemaName = PostgreSQLAppStartup.DEFAULT_SCHEMA_NAME;
}
Statement stmt = null;