From 8372780782104929268c320ae5f846101622ede6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Duy=20Linh?= <138570547+linhpd-axonivy@users.noreply.github.com> Date: Mon, 1 Apr 2024 10:31:30 +0700 Subject: [PATCH] marp-134 bug excel dialog importer (#35) --- .../com/axonivy/util/excel/importer/EntityClassReader.java | 1 - .../com/axonivy/util/excel/importer/EntityDataLoader.java | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/excel-importer/src/com/axonivy/util/excel/importer/EntityClassReader.java b/excel-importer/src/com/axonivy/util/excel/importer/EntityClassReader.java index 1dac757..e5c4927 100644 --- a/excel-importer/src/com/axonivy/util/excel/importer/EntityClassReader.java +++ b/excel-importer/src/com/axonivy/util/excel/importer/EntityClassReader.java @@ -17,7 +17,6 @@ public class EntityClassReader { public final IProjectDataClassManager manager; - @SuppressWarnings("restriction") public EntityClassReader() { this(IDataClassManager.instance().getProjectDataModelFor(Ivy.wfCase().getProcessModelVersion())); } diff --git a/excel-importer/src/com/axonivy/util/excel/importer/EntityDataLoader.java b/excel-importer/src/com/axonivy/util/excel/importer/EntityDataLoader.java index e9d1909..be193aa 100644 --- a/excel-importer/src/com/axonivy/util/excel/importer/EntityDataLoader.java +++ b/excel-importer/src/com/axonivy/util/excel/importer/EntityDataLoader.java @@ -28,7 +28,6 @@ import ch.ivyteam.ivy.scripting.dataclass.IEntityClassField; import ch.ivyteam.log.Logger; -@SuppressWarnings("restriction") public class EntityDataLoader { private static final Logger LOGGER = Logger.getLogger(EntityDataLoader.class); @@ -50,12 +49,11 @@ public void load(Sheet sheet, IEntityClass entity, IProgressMonitor monitor) thr EntityManager em = manager.createEntityManager(); JdbcConnectionAccess access = em.unwrap(SessionImpl.class).getJdbcConnectionAccess(); Connection con = access.obtainConnection(); + con.setAutoCommit(false); try { var stmt = loadRows(entity, rows, con); stmt.executeBatch(); con.commit(); - } catch (Exception ex) { - LOGGER.error("failed to load rows "+ex); } finally { access.releaseConnection(con); em.close(); @@ -105,7 +103,7 @@ private static String buildInsertQuery(IEntityClass entity, List !fld.equals("id")) - .map(f -> ":"+f+"").collect(Collectors.joining(", ")); + .map(f -> "?").collect(Collectors.joining(", ")); query.append(params); query.append(")"); return query.toString();