-
Notifications
You must be signed in to change notification settings - Fork 180
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
Undesirable runtime errors when creating custom types for Array #244
Comments
Yes, we should enhance it. |
Hi @mdedetrich, I added type checking logic, but it only takes effect when running instead of compiling. If you have a better idea, pls don't hesitate to tell me. |
@tminglei I will have a better look as to why this is happening, is there a reason why this happens in Maybe the only thing we need to do is to add implicit conversions from all of the Java JDBC types, which is another solution to the problem |
@mdedetrich, you mean, define another conversion interface, and make implementations for every supported Java JDBC types? |
@tminglei Yes. So we would create default conversions for all of the JDBC types (i.e. |
Ok, I'll try on it. |
@mdedetrich enhanced. Can you help check it again? Thanks! |
@tminglei Looking at it now |
@tminglei All good, seems to be working fine now with zero problems! |
When creating custom types for pg-array's type, its possible to get runtime cast errors (i.e. the code compiles fine)
As an example (and we had this happen to us), you can define a
List[BigDecimal]
mapping like thisYou get a class cast exception at runtime (unable to cast a
java.math.BigDecimal
to ascala.mathBigDecimal
). The following version is what you need to doBoth versions compile fine. The former should throw a compile time error (or work as desired)
The text was updated successfully, but these errors were encountered: