-
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
Custom class is registered as simple type only if there is writing converter #1194
Comments
The behaviour you describe is a bug and should get fixed. The type should NOT be considered a simple type, but custom conversions should be taken into consideration before treating it as an entity. |
But all source types of writing converters always add to custom simple types. Moreover, all custom types in if (converterRegistration.isWriting()) {
writingPairs.add(pair);
customSimpleTypes.add(pair.getSourceType()); // <<<<<<<<<<<<<<<<<<<<
if (logger.isWarnEnabled() && !converterRegistration.isSimpleTargetType()) {
logger.warn(String.format(WRITE_CONVERTER_NOT_SIMPLE, pair.getSourceType(), pair.getTargetType()));
}
} Custom simple types is Why not just add this type when registering a converter for reading? The simple types set will not contain repetitions. |
The code you pointed to resides in So we can't simply undo that change. |
There are three aspects:
|
Related: #1778 but really, the problem here is with |
We had an internal discussion and these are our findings:
Unfortunately these changes are complex and we probably won't be able to tackle them in the near future. |
I am using Spring Data JDBC repository to query data for report (hence, readonly). In one place I needed to convert from JSONB to a DTO. I registered a customer converter marked as
@ReadingConverter
for that purpose, but for some reason it was never called. Debugging the code, I noticed that my DTO is considered as an entity, although it should have been registered as a simple type. Debugging more I found out that only the source type of a@WritingConverter
is registered as a simple type. Adding a dummy writing converter fixed the issue for me. However, this seems unexpected and the fix adds redundant code.My code:
The text was updated successfully, but these errors were encountered: