Skip to content

Commit

Permalink
LPD-25399 Add ctCollectionId to query
Browse files Browse the repository at this point in the history
  • Loading branch information
adolfopa authored and brianchandotcom committed May 9, 2024
1 parent c2c21cf commit b34e629
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,27 @@ protected void doUpgrade() throws Exception {
try (PreparedStatement preparedStatement1 = connection.prepareStatement(
StringBundler.concat(
"select distinct AssetEntry.entryId, ",
"AssetEntry.classTypeId, JournalArticle.DDMStructureId ",
"from AssetEntry, JournalArticle where ",
"AssetEntry.classNameId = ", classNameId,
"AssetEntry.classTypeId, JournalArticle.DDMStructureId, ",
"AssetEntry.ctCollectionId from AssetEntry, ",
"JournalArticle where AssetEntry.classNameId = ",
classNameId,
" 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 = ?");
"update AssetEntry set classTypeId = ? where entryId = ? and " +
"ctCollectionId = ?");
ResultSet resultSet = preparedStatement1.executeQuery()) {

while (resultSet.next()) {
long entryId = resultSet.getLong(1);
long classTypeId = resultSet.getLong(2);

long ddmStructureId = resultSet.getLong(3);
long ctCollectionId = resultSet.getLong(4);

preparedStatement2.setLong(1, ddmStructureId);

preparedStatement2.setLong(2, entryId);
preparedStatement2.setLong(3, ctCollectionId);

preparedStatement2.addBatch();

Expand Down

0 comments on commit b34e629

Please sign in to comment.