Hal, were you able to resolve this? I am trying to achieve the same.

>From what I have read the Postgresql driver support it and for it to work
with a Prepared Statement you need to create a PGobject and set its type to
"uuid" and value to the uuid string. And a setObject on prepared statement
would work. So the 'toDataStoreValue' method should look like this 
        if (object instanceof UUID) {
            PGobject pg = new PGobject();
            pg.setType("uuid");
            try {
                pg.setValue(object.toString());
            } catch (SQLException e) {
                logger.error("Failed to convert value: " + object, e);
            }
            return pg;
        }
        return null;

But, OpenJPA translates the column type from Types.OTHER to Types.BLOB after
calling UuidValueHandler.map
Thats because DBDictionary.getJDBCType defaults to returning Types.BLOB as a
result the setBlobObject is called on PreparedStatement.

My solution was to provide a custom DBDictionary which returns Types.OTHER
for JavaTypes.PC and in UuidValueHandler.map set the java type on the column
to JavaTypes.PC and it worked.



--
View this message in context: 
http://openjpa.208410.n2.nabble.com/OpenJPA-PostgreSQL-UUID-column-tp7587837p7588657.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to