JavaStandalone

Java UUID Primary Keys as RAW(16)

JDBC and Spring Data JPA sample that stores Java UUID primary keys as RAW(16) values in Oracle AI Database.

TestcontainersSpring#Java#JPA#Spring#Testcontainers#UUID
What this sample helps you learn

You can store UUID primary keys as strings, but then the schema stores text for a value that is really 128 bits.

What this sample demonstrates

Testcontainers

Disposable Oracle AI Database Free containers for repeatable local and integration tests.

Use when tests need real database behavior without sharing a long-lived development instance.

Spring

Spring framework samples for data access, messaging, configuration, and application wiring.

Use when Java applications need Spring-managed components backed by Oracle AI Database.

Highlights

  • Java UUID values can be stored as RAW(16) primary keys without string formatting.
  • The JDBC conversion is explicit: most-significant bits first, least-significant bits second.
  • Spring Data JPA can keep UUID as the repository id type while Oracle AI Database stores the id as RAW(16).
  • Testcontainers tests verify the column metadata, stored byte length, byte order, and lookup behavior.