Introduce notion of SQL type code #4088
Replies: 2 comments 2 replies
-
Yep, I think it's a problem that These are often but certainly not always the same thing. So this causes problems and we should separate the two usages. Even I fucked something up as a result of this confusion. |
Beta Was this translation helpful? Give feedback.
2 replies
-
I completely agree. As mentioned in the proposal. I've had this problem also. See e.g. HHH-11490 and HH-14683 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It has come up various times that the JDBC type code was too coarse grained for our purposes and that drivers require certain actions (
setNull
) to happen with the JDBC type code although we need to differentiate different types with the same JDBC type code. One prime example where this is a problem is when someone uses the PostgreSQL geometry type and also some custom JSON type. In both cases it is necessary to use thegetObject
/setObject
APIs and use theTypes.OTHER
type code, but these are different JDBC type descriptors. The currentJdbcTypeDescriptorRegistry
uses the JDBC type code to register type descriptors though. This leads to requiring that the type descriptors are registered under artificial "sql type codes" and provide custom binders/extractors that use the generic JDBC type codeTypes.OTHER
correctly for certain API calls. If we introduce a notion of "sql type codes" in theJdbcTypeDescriptor
and it seemsJdbcTypeDescriptor#getJdbcTypeCode
might just be that (considering there also isJdbcTypeDescriptor#getJdbcType
to which the default implementation delegates), we could handle all this generically. Registrations would happen for both codes, but the lookup by JDBC type code would only be used when trying to find theJdbcTypeDescriptor
for native query results.Beta Was this translation helpful? Give feedback.
All reactions