Skip to content

Commit

Permalink
LPD-41532 search-experiences-service: Change SXPBlueprintUpgradeProce…
Browse files Browse the repository at this point in the history
…ss class to use AutoBatchPreparedStatementUtil

https://liferay.atlassian.net/browse/LPD-41532
  • Loading branch information
AlmirFe authored and liferay-continuous-integration committed Nov 11, 2024
1 parent a4724f0 commit f4cf85a
Showing 1 changed file with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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"));
Expand Down

0 comments on commit f4cf85a

Please sign in to comment.