Case Study Solution
Case Study Solution
Company: Jasmine, a large multinational supermarket company with over 1.5 billion unique
customers.
Problem: The current software uses a 4-byte integer for customer IDs, which is reaching its
limit (2,147,483,647). The CTO has decided to switch to 128-bit UUIDs for new customer IDs
to avoid this limitation.
Constraints:
Solution Approach
Implementation
import java.sql.*;
import java.util.UUID;
ResultSet rs = selectStmt.executeQuery();
while (rs.next()) {
int oldCustomerId =
rs.getInt("old_customer_id");
UUID newCustomerId = UUID.randomUUID();
String customerName =
rs.getString("customer_name");
String address = rs.getString("address");
long rfidNumber = rs.getLong("rfid_number");
Date joinedDate = rs.getDate("joined_date");
insertStmt.setInt(1, oldCustomerId);
insertStmt.setObject(2, newCustomerId);
insertStmt.setString(3, customerName);
insertStmt.setString(4, address);
insertStmt.setLong(5, rfidNumber);
insertStmt.setDate(6, joinedDate);
insertStmt.executeUpdate();
}
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
import java.sql.*;
import java.util.UUID;
Explanation