changed DB from SQLite to H2

This commit is contained in:
North 2014-05-22 17:53:13 +03:00
parent 8619dd6266
commit d3046a9a0d
4 changed files with 9 additions and 7 deletions

View file

@ -23,9 +23,10 @@
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.7.2</version>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.178</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>

View file

@ -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;

View file

@ -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;

View file

@ -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) {
}
}