title: Using UUID for Primary Key using Room with Android
body: <p>I need to sync my Android mobile app with a multi-tenant database in the cloud. I thought the best way to do this was using a UUID for the Primary Key of my tables. I just started using Room and was wondering where/how I might do this and was looking for 1) opinions on using UUID as a PK with Room and 2) where I would implement this (in the model initializing the id column as this is the only way to use @NonNull)?</p>
  <p><strong>UPDATE</strong></p>
  <p>I used INTs but am not convinced it was the right approach. I saw an <a href="https://github.com/android/architecture-components-samples/tree/main/BasicRxJavaSample" rel="noreferrer">example</a> from the android developer site which showed a uuid being used. Certainly would help my cloud syncing routine, but at the expense of speed and space. I was thinking of a hybrid approach where INTs were used for PKs but UUIDs as an additional field. This way I would not have to replicate each UUID for FKs. I did some modeling and it looks like the hybrid approach would be 50% of the size of the full UUID approach (the INT only would be 25% as big).</p>
  <p>Has anybody struggled with this same issue? Did you choose a direction (UUID, INT, or hybrid) and did you regret it or did it work well?</p>