UuidValueHandler.java
Description: Binary data
I’m trying to use the native UUID type for PostgreSQL in my OpenJPA model. I’m using OpenJPA 2.3.0 and at the current level of the PostgreSQL JDBC driver. I’ve tried to accomplish this several times and I’ve gotten a bit further this time. I created a ValueHolder (see attached file) and it does what I believe is the correct setup for this type. I use this as the strategy for the column - i.e. : @Strategy("com.chiralbehaviors.CoRE.openjpa.UuidValueHandler") I’ve validated via breakpoint that the UuidValueHolder is indeed called in setup and when converting values. I’m at the point of trying to do an insert, and regardless of whether I use an actual UUID as the return mapping (i.e. no transform) or a string (UUID.toString()) I get the same error:
I believe that this error comes from the postgres jdbc driver, not openJPA. I’ve even tried using PGObject, which surprisingly works just fine, but throws the same error. In my google searches, this has come across as a typical problem, and I’ve only found solutions for this (hypothesized) for Toplink and Hibernate. The one thing I could find suggested writing the ValueHolder and that does work up until the point I try to actually insert in JDBC land. Note that the UUID is being passed as a byte array. So my question is, am I doing anything incorrect? Missing something? From the error message, it would appear postgresql wants me to cast the result, but I’m not sure how to accomplish that in OpenJPA. It could simply be a red herring. Any help appreciated, as I simply can’t find a working solution via Der Google -Hal |