From f4cf85a0a9ade997e82f59e650b8cb76cc1ed567 Mon Sep 17 00:00:00 2001 From: Almir Ferreira Date: Thu, 7 Nov 2024 15:27:43 -0300 Subject: [PATCH] LPD-41532 search-experiences-service: Change SXPBlueprintUpgradeProcess class to use AutoBatchPreparedStatementUtil https://liferay.atlassian.net/browse/LPD-41532 --- .../v3_0_0/SXPBlueprintUpgradeProcess.java | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/modules/dxp/apps/search-experiences/search-experiences-service/src/main/java/com/liferay/search/experiences/internal/upgrade/v3_0_0/SXPBlueprintUpgradeProcess.java b/modules/dxp/apps/search-experiences/search-experiences-service/src/main/java/com/liferay/search/experiences/internal/upgrade/v3_0_0/SXPBlueprintUpgradeProcess.java index 940238d6c91851..cc424d79cf9b20 100644 --- a/modules/dxp/apps/search-experiences/search-experiences-service/src/main/java/com/liferay/search/experiences/internal/upgrade/v3_0_0/SXPBlueprintUpgradeProcess.java +++ b/modules/dxp/apps/search-experiences/search-experiences-service/src/main/java/com/liferay/search/experiences/internal/upgrade/v3_0_0/SXPBlueprintUpgradeProcess.java @@ -7,6 +7,7 @@ import com.liferay.petra.string.StringBundler; import com.liferay.petra.string.StringPool; +import com.liferay.portal.kernel.dao.jdbc.AutoBatchPreparedStatementUtil; import com.liferay.portal.kernel.json.JSONArray; import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; @@ -125,9 +126,11 @@ private void _upgradeLowLevelSearchOptionsPortlets() throws Exception { PreparedStatement preparedStatement2 = connection.prepareStatement( "select externalReferenceCode from SXPBlueprint where " + "sxpBlueprintId = ?"); - PreparedStatement preparedStatement3 = connection.prepareStatement( - "update PortletPreferenceValue set smallValue = ? where " + - "portletPreferencesId = ? and name = 'attributes'")) { + PreparedStatement preparedStatement3 = + AutoBatchPreparedStatementUtil.concurrentAutoBatch( + connection, + "update PortletPreferenceValue set smallValue = ? where " + + "portletPreferencesId = ? and name = 'attributes'")) { while (resultSet1.next()) { String smallValue = resultSet1.getString("smallValue"); @@ -173,10 +176,12 @@ private void _upgradeSearchBarPortlets() throws Exception { PreparedStatement preparedStatement2 = connection.prepareStatement( "select externalReferenceCode from SXPBlueprint where " + "sxpBlueprintId = ?"); - PreparedStatement preparedStatement3 = connection.prepareStatement( - "update PortletPreferenceValue set largeValue = ? where " + - "portletPreferencesId = ? and name = " + - "'suggestionsContributorConfigurations'")) { + PreparedStatement preparedStatement3 = + AutoBatchPreparedStatementUtil.concurrentAutoBatch( + connection, + "update PortletPreferenceValue set largeValue = ? where " + + "portletPreferencesId = ? and name = " + + "'suggestionsContributorConfigurations'")) { while (resultSet1.next()) { String largeValue = resultSet1.getString("largeValue"); @@ -231,10 +236,12 @@ private void _upgradeSXPBlueprintOptionsPortlets() { PreparedStatement preparedStatement2 = connection.prepareStatement( "select externalReferenceCode from SXPBlueprint where " + "sxpBlueprintId = ?"); - PreparedStatement preparedStatement3 = connection.prepareStatement( - "update PortletPreferenceValue set name = ?, smallValue = ? " + - "where portletPreferencesId = ? and name = " + - "'sxpBlueprintId'")) { + PreparedStatement preparedStatement3 = + AutoBatchPreparedStatementUtil.concurrentAutoBatch( + connection, + "update PortletPreferenceValue set name = ?, smallValue " + + "= ? where portletPreferencesId = ? and name = " + + "'sxpBlueprintId'")) { while (resultSet1.next()) { preparedStatement2.setLong(1, resultSet1.getLong("smallValue"));