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
DataType.getArrayDataType() should wrap custom Converter<T, U> implementations into Converter<T[], U[]> automatically #10664
Comments
Thanks a lot for your report. This is specific to Side note, you can create ad-hoc converters using |
In fact, the bug isn't specific to |
We should also offer the fix as public API, via |
A separate issue is how to support custom bindings in |
I cannot seem to reproduce this with jOOQ 3.14.0. Will try again next week with 3.13.5 to see if it was already fixed. |
Indeed, the problem is reproducible in 3.13.6-SNAPSHOT. There have been a lot of changes in the area of data types in 3.14. Given the complexity and implied risks arising from a backport. I prefer not to backport any fixes in this area. 3.14 will ship soon. |
3.14 would be fine for me. We did just notice a case where this actually worked with arrayAggDistinct on 3.13.5, haven't looked into what was different there. |
Hmm, so perhaps I did something differently when I tried reproducing this? 3.14 will be released soon. If you can still reproduce this with 3.14, please reopen this issue and I'll have another look |
See also: #7471 |
I can confirm this now works with the latest 3.14 version |
I'm hitting this again on |
While debugging I noticed that the converter isn't even being applied. My change was: data class Wrapper(val value: String) to data class SomeOtherWrapper(val value: String)
data class Wrapper(value: SomeOtherWrapper) Previously it worked due to the logic at the end of Problem is still, that the String->Wrapper converter is not being applied in the String[]->Wrapper[] case. One workaround for everyone else hitting this: Add a secondary constructor (can be private) that wraps the value and calls the primary constructor. |
I just found your not-yet-answered comments, @pschichtel. Is this still a problem? Is this the same problem as your original one? In either case, I think it would be worth creating a new issue with a new description and reproducer. I'm not entirely sure if it's the same problem, and since this issue is already closed, it isn't on my radar anymore. |
Yeah I think what I was describing in the last comment is the problem this issues was originally about, but back when reporting this issue I didn't fully understand how to trigger it. I can try to extract a reproducer from our code base tomorrow and report it as a new issue. |
I am not sure if I am hitting he same issue; here is MCVE. There is a solution but it is not pretty (explained why at the end)
Similar issue here:
My main problem is not that I am unable to create the convertor (as I show there are workarounds) but that I need to construct it from scratch. When I am working with a table (generated or not) and have We actually offer the user to choose the Id datatype for the tables (either Long, or UUID). We then pass DataType throughout the application as a parameter. We are starting to use arrays in some scenarios and are hit with unexpected behavior. Is it indeed intended that:
does not produce usable Tested on 3.16.4 and Postgres. |
@juriad Yes I think that's exactly the issue, yes. Would you mind opening the new issue for that? I can add my reproducer to that as well when I get to creating it. |
To make it even worse, if the
This means that there does not exist a single definition of |
Thanks again for your comments, folks. I'm currently working on the fix in this issue here: #13073 The new fix will be backported to 3.16 and 3.15. |
Expected behavior
jOOQ should be able to apply converters even on array types.
Actual behavior
jOOQ is unable to find the converter for the custom type when the conversion is happening while converting an array.
Steps to reproduce the problem
Kotlin code being used:
The working example produces the following output on the console:
The failing example produces the following stacktrace:
Versions
The text was updated successfully, but these errors were encountered: