Skip to content

Commit

Permalink
marp-134 bug excel dialog importer (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phạm Duy Linh authored Apr 1, 2024
1 parent a6fc81c commit 8372780
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class EntityClassReader {

public final IProjectDataClassManager manager;

@SuppressWarnings("restriction")
public EntityClassReader() {
this(IDataClassManager.instance().getProjectDataModelFor(Ivy.wfCase().getProcessModelVersion()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -105,7 +103,7 @@ private static String buildInsertQuery(IEntityClass entity, List<? extends IEnti
var query = new StringBuilder("INSERT INTO "+tableName+" ("+colNames+")\nVALUES (");
var params = fields.stream().map(IEntityClassField::getName)
.filter(fld -> !fld.equals("id"))
.map(f -> ":"+f+"").collect(Collectors.joining(", "));
.map(f -> "?").collect(Collectors.joining(", "));
query.append(params);
query.append(")");
return query.toString();
Expand Down

0 comments on commit 8372780

Please sign in to comment.