-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Postgres UUID arrays using JDBC #1567
Comments
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged
label
Jul 19, 2023
|
mp911de
added
type: enhancement
A general enhancement
and removed
status: waiting-for-triage
An issue we've not yet triaged
labels
Jul 19, 2023
mp911de
changed the title
Spring Data JDBC , Postgres and UUID array type not working together
Add support for Postgres UUID arrays using JDBC
Jul 19, 2023
mp911de
added a commit
that referenced
this issue
Jul 19, 2023
We now use Postgres' JDBC drivers TypeInfoCache to register and determine array types including support for UUID. Closes #1567
mp911de
added a commit
that referenced
this issue
Jul 19, 2023
We now use Postgres' JDBC drivers TypeInfoCache to register and determine array types including support for UUID. Closes #1567
schauder
pushed a commit
that referenced
this issue
Sep 6, 2023
We now use Postgres' JDBC drivers TypeInfoCache to register and determine array types including support for UUID. Closes #1567
I have another workaround class UUIDSQLType implements SQLType {
@Override
public String getName() {
return "uuid";
}
@Override
public String getVendor() {
return "Postgres";
}
@Override
public Integer getVendorTypeNumber() {
return JDBCType.OTHER.getVendorTypeNumber();
}
}
@Configuration
class DataJdbcConfig extends AbstractJdbcConfiguration {
@Override
protected List<?> userConverters() {
return Arrays.asList(new UUIDWritingConverter());
}
@WritingConverter
static class UUIDWritingConverter implements Converter<UUID, JdbcValue> {
@Override
public JdbcValue convert(UUID source) {
return JdbcValue.of(source, new UUIDSQLType());
}
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi again,
First of all - let me tell you that I love Spring Data JDBC ❤️! It makes life 🎉!
I noticed that the combination of Spring Data JDBC, Postgres and UUID array type doesn't seem to work. My guess is this is because of the fact that
java.sql.JDBCType
does not contain an entry for UUID - is that correct?To reproduce:
schema.sql
Record to save
The exception message
Caused by: org.postgresql.util.PSQLException: Unable to find server array type for provided name UNKNOWN.
Workaround
My current workaround is to create the
JdbcTypeFactory
:Question
Would this (ugly) workaround be accepted as a PR or what would be the best way to get UUID support for arrays into Spring Boot JDBC?
The text was updated successfully, but these errors were encountered: