From d3046a9a0de2bbd4d0c0007234fa893ec7a84cdf Mon Sep 17 00:00:00 2001 From: North Date: Thu, 22 May 2014 17:53:13 +0300 Subject: [PATCH] changed DB from SQLite to H2 --- Mage/pom.xml | 7 ++++--- Mage/src/mage/cards/repository/CardInfo.java | 2 +- Mage/src/mage/cards/repository/CardRepository.java | 2 +- Mage/src/mage/cards/repository/ExpansionRepository.java | 5 +++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Mage/pom.xml b/Mage/pom.xml index 311367fbce..d4fc31d3c5 100644 --- a/Mage/pom.xml +++ b/Mage/pom.xml @@ -23,9 +23,10 @@ - org.xerial - sqlite-jdbc - 3.7.2 + com.h2database + h2 + 1.4.178 + runtime com.j256.ormlite diff --git a/Mage/src/mage/cards/repository/CardInfo.java b/Mage/src/mage/cards/repository/CardInfo.java index 6b8544a95e..b4037520cf 100644 --- a/Mage/src/mage/cards/repository/CardInfo.java +++ b/Mage/src/mage/cards/repository/CardInfo.java @@ -77,7 +77,7 @@ public class CardInfo { protected String supertypes; @DatabaseField protected String manaCosts; - @DatabaseField + @DatabaseField(dataType = DataType.STRING, width = 500) protected String rules; @DatabaseField protected boolean black; diff --git a/Mage/src/mage/cards/repository/CardRepository.java b/Mage/src/mage/cards/repository/CardRepository.java index 9957643f13..b38f26a511 100644 --- a/Mage/src/mage/cards/repository/CardRepository.java +++ b/Mage/src/mage/cards/repository/CardRepository.java @@ -53,7 +53,7 @@ public enum CardRepository { instance; - private static final String JDBC_URL = "jdbc:sqlite:db/cards.db"; + private static final String JDBC_URL = "jdbc:h2:file:./db/cards.h2"; private static final String VERSION_ENTITY_NAME = "card"; private static final long CARD_DB_VERSION = 33; diff --git a/Mage/src/mage/cards/repository/ExpansionRepository.java b/Mage/src/mage/cards/repository/ExpansionRepository.java index 329d7dce22..95bd767f60 100644 --- a/Mage/src/mage/cards/repository/ExpansionRepository.java +++ b/Mage/src/mage/cards/repository/ExpansionRepository.java @@ -21,7 +21,7 @@ public enum ExpansionRepository { instance; - private static final String JDBC_URL = "jdbc:sqlite:db/cards.db"; + private static final String JDBC_URL = "jdbc:h2:file:./db/cards.h2"; private static final String VERSION_ENTITY_NAME = "expansion"; private static final long EXPANSION_DB_VERSION = 3; @@ -43,13 +43,14 @@ public enum ExpansionRepository { TableUtils.createTableIfNotExists(connectionSource, ExpansionInfo.class); expansionDao = DaoManager.createDao(connectionSource, ExpansionInfo.class); } catch (SQLException ex) { + ex.printStackTrace(); } } public void add(ExpansionInfo expansion) { try { expansionDao.create(expansion); - } catch (SQLException e) { + } catch (SQLException ex) { } }