In our previous post we covered creating an auto generating UUID primary key in PostgreSQL. As a follow-up we're going to enter a UUID in a table using a PostgreSQL Prepared Statement in Java.
Here's our simply logging table that we used in the past. We're entering device_guid in Java.
Below is the essential Java. DeviceGuid is obtained from the client through a REST service so for simplicity sake we're initially defining it as a String. The pst.setObject(1, UUID.fromString(…)) is the code that gets the job done for us.