When using SQL Object argument binding, does JDBI work out-of-the-box with UUID parameters?
I have a method such as this:
@SqlQuery("EXECUTE [MyProcedure] :myField")
MyDto myMethod(@Bind("myField") UUID myField);
which is bound to a SQL Server stored procedure that receives a parameter like this:
@myField uniqueidentifier
When executed, this exception is thrown:
! com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from UNKNOWN to UNKNOWN is unsupported.
! at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
! at com.microsoft.sqlserver.jdbc.DataTypes.throwConversionError(DataTypes.java:1117)
! at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(SQLServerPreparedStatement.java:991)
If I change the parameter type on JDBI to String, and call it using the toString() method from the UUID object, it works:
@SqlQuery("EXECUTE [MyProcedure] :myField")
MyDto trash(@Bind("myField") String myField);
Is there a way to write my DAO methods accepting UUID parameters and have them converted to strings before binding?