From f712107fb8a23c747fc27a1d686c61b5593e1dc8 Mon Sep 17 00:00:00 2001 From: Redkale <22250530@qq.com> Date: Wed, 2 May 2018 20:46:38 +0800 Subject: [PATCH] --- src/org/redkale/source/DataSqlSource.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/org/redkale/source/DataSqlSource.java b/src/org/redkale/source/DataSqlSource.java index 957c06b84..c67491109 100644 --- a/src/org/redkale/source/DataSqlSource.java +++ b/src/org/redkale/source/DataSqlSource.java @@ -230,7 +230,9 @@ public abstract class DataSqlSource 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 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 extends AbstractService implement if (values.length == 0) return CompletableFuture.completedFuture(-1); if (values.length > 1) { //检查对象是否都是同一个Entity类 Class clazz = null; - CompletableFuture future = new CompletableFuture<>(); for (T val : values) { if (clazz == null) { clazz = val.getClass(); continue; } if (clazz != val.getClass()) { + CompletableFuture 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 extends AbstractService implement return c; } //----------------------------- update ----------------------------- - + //----------------------------- find ----------------------------- /** * 根据主键获取对象