diff --git a/src/client/java/teammates/client/scripts/sql/DataMigrationForAccountAndReadNotificationSql.java b/src/client/java/teammates/client/scripts/sql/DataMigrationForAccountAndReadNotificationSql.java index 0d7becb01ec..2401b05acc2 100644 --- a/src/client/java/teammates/client/scripts/sql/DataMigrationForAccountAndReadNotificationSql.java +++ b/src/client/java/teammates/client/scripts/sql/DataMigrationForAccountAndReadNotificationSql.java @@ -20,11 +20,6 @@ import com.google.cloud.datastore.QueryResults; import com.googlecode.objectify.cmd.Query; -import jakarta.persistence.TypedQuery; -import jakarta.persistence.criteria.CriteriaBuilder; -import jakarta.persistence.criteria.CriteriaQuery; -import jakarta.persistence.criteria.Root; - // import jakarta.persistence.criteria.CriteriaDelete; import teammates.client.connector.DatastoreClient; @@ -131,27 +126,6 @@ private void doMigration(teammates.storage.entity.Account entity) { * Migrates the entity. */ protected void migrateEntity(teammates.storage.entity.Account oldAccount) { - HibernateUtil.beginTransaction(); - - CriteriaBuilder cb = HibernateUtil.getCriteriaBuilder(); - CriteriaQuery cr = cb.createQuery( - teammates.storage.sqlentity.Account.class); - Root root = cr.from(teammates.storage.sqlentity.Account.class); - cr.select(root).where(cb.equal(root.get("googleId"), oldAccount.getGoogleId())); - - TypedQuery query = HibernateUtil.createQuery(cr); - - - boolean isEntityInDb = query.getResultList().size() != 0; - HibernateUtil.commitTransaction(); - - // In db, but somehow not set as migrated. - if (isEntityInDb) { - oldAccount.setMigrated(true); - entitiesOldAccountSavingBuffer.add(oldAccount); - return; - }; - teammates.storage.sqlentity.Account newAccount = new teammates.storage.sqlentity.Account( oldAccount.getGoogleId(), oldAccount.getName(), @@ -162,6 +136,7 @@ protected void migrateEntity(teammates.storage.entity.Account oldAccount) { oldAccount.setMigrated(true); entitiesOldAccountSavingBuffer.add(oldAccount); migrateReadNotification(oldAccount, newAccount); + } private void migrateReadNotification(teammates.storage.entity.Account oldAccount,