TypeConverter not used for inserting/updating type Object
See original GitHub issueTypeConverters are working wonderfully for reading/querying and writing/inserting/updating data except for one case: when you’re trying to insert/update and expect a value to be converted before being bound to the statement.
You can see in this code where the problem is:
All other data types have a nice callout to convertRequired
except for the Object. This means my TypeConvert doesn’t get utilized, resulting in a JDBC error. The specific use case is I’m trying to convert into JSONB type in Postgres. Interestingly, it works on queries because the code doesn’t even try to understand the underlying type, it simply passes all ResultSet values off to the type converters:
I’ll see if I can get you a patch soon!
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Room Database TypeConverter is not used in some ...
My type converter uses a different delimiter, so the queries are not compatible! If the set is empty, the SQL string is not...
Read more >TypeConverter Class (System.ComponentModel)
Provides a unified way of converting types of values to other types, as well as for accessing standard values and subproperties.
Read more >Referencing complex data using Room - Android Developers
Use type converters. Control type converter initialization. Understand why Room doesn't allow object references.
Read more >Type converters - Drift - Simon Binder
You can achieve this by using TypeConverters . ... If your converter returns an object that is not comparable by value, the generated...
Read more >LLBLGen Pro SDK - Implementing a type converter.
LLBLGen Pro comes with a handy conversion functionality for conversion values at runtime: type converters. Type Converters are objects which can be used...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the similar issue when use a List of JsonType, e.g.
Query and Create are ok. but got error when update this field to postgres DB: The column index is out of range I found a work around: create wrapper for the List, e.g
UserList is just a wrapper:
Hope this can help anyone has the same issue.
Thanks @zearic for the tip. I still have the issue storing Map in JSONB column and have to use the workaround.