Skip to content

Commit

Permalink
Add heartbeat sql to resolve some problem
Browse files Browse the repository at this point in the history
  • Loading branch information
caoli5288 committed May 24, 2016
1 parent be42524 commit ffd76a2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/mengcraft/simpleorm/EbeanHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public void initialize(String name) throws DatabaseException {

DataSourceConfig sourceConfig = new DataSourceConfig();

sourceConfig.setHeartbeatSql("select 1");
sourceConfig.setDriver(driver);
sourceConfig.setUrl(url);
sourceConfig.setUsername(userName);
Expand All @@ -137,12 +138,13 @@ public void initialize(String name) throws DatabaseException {
sourceConfig.setMinConnections(coreSize);
sourceConfig.setMaxConnections(maxSize);

ServerConfig serverConfig = new ServerConfig();

if (this.isolationLevel != null) {
sourceConfig.setIsolationLevel(this.isolationLevel.getRawLevel());
}

ServerConfig serverConfig = new ServerConfig();

if (driver.contains("sqlite")) {
// Rewrite isolation level if is SQLite platform.
sourceConfig.setIsolationLevel(8);
Expand Down

0 comments on commit ffd76a2

Please sign in to comment.