Skip to content

Commit

Permalink
LPD-25416 Use batch prepared statement
Browse files Browse the repository at this point in the history
  • Loading branch information
adolfopa authored and brianchandotcom committed May 9, 2024
1 parent b34e629 commit 5a773fb
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import com.liferay.journal.model.JournalArticle;
import com.liferay.petra.string.StringBundler;
import com.liferay.portal.kernel.dao.jdbc.AutoBatchPreparedStatementUtil;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.service.ClassNameLocalService;
Expand Down Expand Up @@ -49,9 +50,11 @@ protected void doUpgrade() throws Exception {
" and (AssetEntry.classPK = JournalArticle.id_ or ",
"AssetEntry.classPK = JournalArticle.resourcePrimKey) and ",
"AssetEntry.classTypeId != JournalArticle.DDMStructureId"));
PreparedStatement preparedStatement2 = connection.prepareStatement(
"update AssetEntry set classTypeId = ? where entryId = ? and " +
"ctCollectionId = ?");
PreparedStatement preparedStatement2 =
AutoBatchPreparedStatementUtil.autoBatch(
connection,
"update AssetEntry set classTypeId = ? where entryId = ? " +
"and ctCollectionId = ?");
ResultSet resultSet = preparedStatement1.executeQuery()) {

while (resultSet.next()) {
Expand Down

0 comments on commit 5a773fb

Please sign in to comment.