Mike Kolesnik has posted comments on this change. Change subject: core: Introducing Batch updates to DAOs ......................................................................
Patch Set 3: I would prefer that you didn't submit this (7 inline comments) If the classes you need are internal, I don't see a reason to have them outside the class that uses them (SimpleJdbcCallsHandler) instead of inner classes.. I think inner classes would be less messy .................................................... File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/SimpleJdbcCallsHandler.java Line 56: * @param executions Line 57: * A list of parameter maps Line 58: * @return Line 59: */ Line 60: public void runBatch(final String procName, Why call "runXXX" if other methods called "executeXXX"? Line 61: final List<MapSqlParameterSource> executions) Line 62: throws DataAccessException { Line 63: Line 64: template.execute(new ConnectionCallback<Object>() { Line 74: Line 75: for (MapSqlParameterSource execution : executions) { Line 76: mapParams(stmt, execution, Line 77: procMetaData.getParamatersMetaData()); Line 78: stmt.addBatch(); Have you tried using JdbcTemplate.batchUpdate instead of rewriting most of it's logic? Line 79: } Line 80: Line 81: try { Line 82: stmt.executeBatch(); Line 86: e.getNextException()); Line 87: throw e; Line 88: } Line 89: Line 90: stmt.close(); You should close statement in finally block Line 91: Line 92: return null; Line 93: } Line 94: Line 148: Line 149: if (params.length() > 0) { Line 150: params.deleteCharAt(params.length() - 1); Line 151: } Line 152: rs2.close(); You should close result set in finally block Line 153: Line 154: StringBuffer sqlCommand = new StringBuffer(); Line 155: sqlCommand.append("{call ").append(procSchemaFromDB) Line 156: .append(".").append(procNameFromDB).append("(") Line 151: } Line 152: rs2.close(); Line 153: Line 154: StringBuffer sqlCommand = new StringBuffer(); Line 155: sqlCommand.append("{call ").append(procSchemaFromDB) This is very DB specific... Is there a way to use some more generic approach? Perhaps something regarding SqlProvider? Line 156: .append(".").append(procNameFromDB).append("(") Line 157: .append(params).append(")}"); Line 158: Line 159: procMetaData.setSqlCommand(sqlCommand.toString()); .................................................... File backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BatchDaoTest.java Line 14: import org.ovirt.engine.core.compat.NGuid; Line 15: import org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource; Line 16: import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; Line 17: Line 18: public class BatchDaoTest extends BaseDAOTestCase { Name is confusing, you're testing SimpleJdbcCallsHandler, not BatchDao Line 19: Line 20: private TagDAO dao; Line 21: Line 22: public BatchDaoTest() { Line 16: import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; Line 17: Line 18: public class BatchDaoTest extends BaseDAOTestCase { Line 19: Line 20: private TagDAO dao; I'm no sure that relying on any specific DAO from the project is a good idea.. Perhaps you can find a way to test this without relying on a DAO. Line 21: Line 22: public BatchDaoTest() { Line 23: } Line 24: -- To view, visit http://gerrit.ovirt.org/15039 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If5ee0aa90bca3b5c257beb7b0eaa236f02f0206f Gerrit-PatchSet: 3 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Liran Zelkha <liran.zel...@gmail.com> Gerrit-Reviewer: Mike Kolesnik <mkole...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches