This commit is contained in:
Redkale
2018-05-02 20:46:38 +08:00
parent fb3dd6049d
commit f712107fb8

View File

@@ -230,7 +230,9 @@ public abstract class DataSqlSource<DBChannel> extends AbstractService implement
continue;
}
if (clazz != val.getClass()) {
throw new RuntimeException("DataSource.insert must the same Class Entity, but diff is " + clazz + " and " + val.getClass());
CompletableFuture<Void> future = new CompletableFuture<>();
future.completeExceptionally(new SQLException("DataSource.insert must the same Class Entity, but diff is " + clazz + " and " + val.getClass()));
return future;
}
}
}
@@ -305,13 +307,13 @@ public abstract class DataSqlSource<DBChannel> extends AbstractService implement
if (values.length == 0) return CompletableFuture.completedFuture(-1);
if (values.length > 1) { //检查对象是否都是同一个Entity类
Class clazz = null;
CompletableFuture<Integer> future = new CompletableFuture<>();
for (T val : values) {
if (clazz == null) {
clazz = val.getClass();
continue;
}
if (clazz != val.getClass()) {
CompletableFuture<Integer> future = new CompletableFuture<>();
future.completeExceptionally(new SQLException("DataSource.delete must the same Class Entity, but diff is " + clazz + " and " + val.getClass()));
return future;
}
@@ -450,7 +452,7 @@ public abstract class DataSqlSource<DBChannel> extends AbstractService implement
return c;
}
//----------------------------- update -----------------------------
//----------------------------- find -----------------------------
/**
* 根据主键获取对象