提交 c11b45e8 编写于 作者: R Ray

增加detach的null判断

上级 98e5fe79
......@@ -1531,11 +1531,7 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
}
public <T extends JpaObject> Integer delete(Class<T> clz, String... ids) throws Exception {
List<String> list = new ArrayList<>();
for (String o : ids) {
list.add(o);
}
return this.delete(clz, list);
return this.delete(clz, Arrays.asList(ids));
}
public <T extends JpaObject> List<T> deleteEqual(Class<T> cls, String attribute, Object value) throws Exception {
......
......@@ -86,8 +86,12 @@ public class JpaObjectTools {
* @param objects
*/
public static <T extends JpaObject> void detach(EntityManager em, Collection<T> objects) {
for (JpaObject o : objects) {
em.detach(o);
if (null != objects) {
for (JpaObject o : objects) {
if (null != o) {
em.detach(o);
}
}
}
}
......@@ -99,7 +103,9 @@ public class JpaObjectTools {
*/
public static void detach(EntityManager em, JpaObject... objects) {
for (JpaObject o : objects) {
em.detach(o);
if (null != o) {
em.detach(o);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册