summaryrefslogtreecommitdiff
path: root/myapp/src/main/java/io/trygvis
diff options
context:
space:
mode:
Diffstat (limited to 'myapp/src/main/java/io/trygvis')
-rw-r--r--myapp/src/main/java/io/trygvis/container/myapp/AddressBookDirect.java13
1 files changed, 5 insertions, 8 deletions
diff --git a/myapp/src/main/java/io/trygvis/container/myapp/AddressBookDirect.java b/myapp/src/main/java/io/trygvis/container/myapp/AddressBookDirect.java
index 7cb6b54..cd76c84 100644
--- a/myapp/src/main/java/io/trygvis/container/myapp/AddressBookDirect.java
+++ b/myapp/src/main/java/io/trygvis/container/myapp/AddressBookDirect.java
@@ -23,6 +23,7 @@ public class AddressBookDirect {
sessionFactory = new MyAppSqlSessionFactory(new DriverManagerDataSource(jdbcUrl));
new AddressBookDirect().work();
} catch (EOFException ignore) {
+ // Happens when the user closes stdin.
}
}
@@ -89,19 +90,15 @@ public class AddressBookDirect {
}
public void create() throws SQLException {
- session.executeUpdate(CompanyDao.createTableSql);
- session.executeUpdate(ContactDao.createTableSql);
- for (String sql : Sequences.createSequences) {
- session.executeUpdate(sql);
+ for (String s : sessionFactory.getUnit().create()) {
+ session.executeUpdate(s);
}
}
public void drop() throws SQLException {
- for (String sql : Sequences.dropSequences) {
- session.executeUpdate(sql);
+ for (String s : sessionFactory.getUnit().drop()) {
+ session.executeUpdate(s);
}
- session.executeUpdate(ContactDao.dropTableSql);
- session.executeUpdate(CompanyDao.dropTableSql);
}
// -----------------------------------------------------------------------