diff --git a/.travis.yml b/.travis.yml
index a1407b9..9e0d03b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,5 +2,5 @@ language: java
jdk:
- oraclejdk8
script:
- - mvn install -Dmaven.test.skip=true
+ - mvn compile -Dmaven.test.skip=true
diff --git a/README.md b/README.md
index 7c08f45..d5104a6 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,13 @@
## 更新日志
+### v0.2.2
+
+1. 修复 `in` 查询问题
+2. 添加单条自定义类型查询
+3. 添加查询自定义类型列表
+4. SQL关键词大写
+
### v0.2.0
1. 使用Java8重构
diff --git a/pom.xml b/pom.xml
index 9828cd3..9314df1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.bladejava
blade-jdbc
- 0.2.2-alpha1
+ 0.2.2-RELEASE
jar
blade-jdbc
@@ -53,8 +53,8 @@
org.projectlombok
lombok
- 1.16.16
- compile
+ 1.16.18
+ provided
diff --git a/src/main/java/com/blade/jdbc/Base.java b/src/main/java/com/blade/jdbc/Base.java
index cfa3317..585617e 100644
--- a/src/main/java/com/blade/jdbc/Base.java
+++ b/src/main/java/com/blade/jdbc/Base.java
@@ -18,11 +18,19 @@ public final class Base {
public static Sql2o open(String url, String user, String password) {
sql2o = new Sql2o(url, user, password);
+ log.info("⬢ Blade-JDBC initializing");
return sql2o;
}
public static Sql2o open(DataSource dataSource) {
sql2o = new Sql2o(dataSource);
+ log.info("⬢ Blade-JDBC initializing");
+ return sql2o;
+ }
+
+ public static Sql2o open(Sql2o sql2o_) {
+ sql2o = sql2o_;
+ log.info("⬢ Blade-JDBC initializing");
return sql2o;
}
@@ -35,14 +43,12 @@ public static Sql2o open(DataSource dataSource) {
public static T atomic(Supplier supplier) {
T result = null;
try {
- connectionThreadLocal.remove();
- connectionThreadLocal.set(sql2o.beginTransaction());
- try (Connection con = connectionThreadLocal.get()) {
- result = supplier.get();
- con.commit();
- }
+ Connection connection = sql2o.beginTransaction();
+ connectionThreadLocal.set(connection);
+ result = supplier.get();
+ connection.commit();
} catch (RuntimeException e) {
- log.info("Transaction rollback");
+ log.warn("Transaction rollback");
connectionThreadLocal.get().rollback();
throw e;
} finally {
diff --git a/src/main/java/com/blade/jdbc/Const.java b/src/main/java/com/blade/jdbc/Const.java
new file mode 100644
index 0000000..f75e633
--- /dev/null
+++ b/src/main/java/com/blade/jdbc/Const.java
@@ -0,0 +1,25 @@
+package com.blade.jdbc;
+
+/**
+ * Blade JDBC Const
+ *
+ * @author biezhi
+ * @date 2017/11/10
+ */
+public interface Const {
+
+ String SPACE = " ";
+ String SQL_AND = "AND";
+ String SQL_OR = "OR";
+ String SQL_WHERE = "WHERE";
+ String SQL_IN = "IN";
+ String SQL_INSERT = "INSERT INTO";
+
+ String SQL_QM = "?";
+ String EXECUTE_SQL_PREFIX = "⬢ Execute SQL";
+ String PARAMETER_PREFIX = "⬢ Parameters ";
+
+ char IN_START = '(';
+ char IN_END = ')';
+
+}
diff --git a/src/main/java/com/blade/jdbc/core/ActiveRecord.java b/src/main/java/com/blade/jdbc/core/ActiveRecord.java
index 95394e3..5e89f0e 100644
--- a/src/main/java/com/blade/jdbc/core/ActiveRecord.java
+++ b/src/main/java/com/blade/jdbc/core/ActiveRecord.java
@@ -7,17 +7,26 @@
import com.blade.jdbc.page.PageRow;
import com.blade.jdbc.utils.Unchecked;
import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
import org.sql2o.Connection;
import org.sql2o.Query;
import org.sql2o.Sql2o;
import java.io.Serializable;
-import java.lang.invoke.SerializedLambda;
-import java.lang.reflect.Method;
import java.util.*;
import java.util.function.Supplier;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
+import static com.blade.jdbc.Const.*;
+
+/**
+ * ActiveRecord Parent Class
+ *
+ * @author biezhi
+ * @date 2017/11/10
+ */
+@Slf4j
public class ActiveRecord implements Serializable {
@Transient
@@ -30,10 +39,6 @@ public class ActiveRecord implements Serializable {
@Transient
private Set saveOrUpdateProperties = new TreeSet<>();
- @Transient
- private List whereKeys = new ArrayList<>();
- private List