From 331a04c07c19ddff5a1826575e89050cd3193b9a Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Tue, 5 May 2009 03:21:07 +0000 Subject: [PATCH] Some changes to make it easier to run the sample with the database driver as part of the jetty plugin configuration, preventing classloader leaks. --- samples/contacts/pom.xml | 22 ++++++++++++++----- .../sample/contact/DataSourcePopulator.java | 12 ++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/samples/contacts/pom.xml b/samples/contacts/pom.xml index 4f6a108d18..098b3277a6 100644 --- a/samples/contacts/pom.xml +++ b/samples/contacts/pom.xml @@ -66,16 +66,16 @@ net.sf.ehcache ehcache - - hsqldb - hsqldb - runtime - hessian hessian 3.0.1 + + hsqldb + hsqldb + runtime + log4j log4j @@ -96,11 +96,21 @@ /contacts - 10 + 5 + diff --git a/samples/contacts/src/main/java/sample/contact/DataSourcePopulator.java b/samples/contacts/src/main/java/sample/contact/DataSourcePopulator.java index 4d70eeaf99..fc4bd133fe 100644 --- a/samples/contacts/src/main/java/sample/contact/DataSourcePopulator.java +++ b/samples/contacts/src/main/java/sample/contact/DataSourcePopulator.java @@ -76,6 +76,18 @@ public class DataSourcePopulator implements InitializingBean { AuthorityUtils.createAuthorityList("ROLE_IGNORED")); SecurityContextHolder.getContext().setAuthentication(authRequest); + try { + template.execute("DROP TABLE CONTACTS"); + template.execute("DROP TABLE AUTHORITIES"); + template.execute("DROP TABLE USERS"); + template.execute("DROP TABLE ACL_ENTRY"); + template.execute("DROP TABLE ACL_OBJECT_IDENTITY"); + template.execute("DROP TABLE ACL_CLASS"); + template.execute("DROP TABLE ACL_SID"); + } catch(Exception e) { + System.out.println("Failed to drop tables: " + e.getMessage()); + } + template.execute( "CREATE TABLE ACL_SID(" + "ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 100) NOT NULL PRIMARY KEY," +