Custom type encoding (UUID)
See original GitHub issueHi,
I’m trying to insert a UUID in a DB but the save
call fails saying that there are no encoders supporting this type. Indeed DefaultCodecs
does not have a UUIDCodec
. I was not able to find a way to add a custom Codec though. Did I miss something? How would you recommend I can fix my problem?
For context, my DAO looks like this:
class Person {
@Id
Long id;
UUID userUuid;
String name;
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Avro custom decoding of UUID through kafka on consumer end
I've written a class to custom encode objects of UUID type to bytes to be transported across kafka and avro. To use this...
Read more >Customizing how an external Swift type is encoded or decoded
Various ways to handle mismatches between how an external type is expected to be coded and the data format that an app is...
Read more >Introduction — ramsey/uuid stable Manual
The most widely-known and used types of UUIDs are defined by RFC 4122. A UUID, when encoded in hexadecimal string format, looks like:....
Read more >Message Repository Table Schema - EventSauce
The UUID Encoding package allows customizing how the UUIDs used for the event ID and the aggregate root ID are converted to string...
Read more >Fixing issues with Codable identifiers | by Mason O'Neil
Generating the UUID inline will create a new unique identifier every time a new Employee object is instantiated. Perfect! However, the value ...
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 FreeTop 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
Top GitHub Comments
Good at evasions, huh? It that’s so, why does Spring Data JPA with a non-reactive driver support it no sweat? I’ll tell you why - because your statement is a lie. MySQL does support UUID, although it doesn’t have a separate data type for it like Postgres. That’s why it has the UUID() function, whose return value can be stored in a CHAR column. And if you apply UUID_TO_BIN() function to this value, you can store it compressed in a BINARY column. So say it straight - you are plain lazy to implement it, although it’s needed and two years have passed since this report.
I managed to achieve what I want by registering custom Converters:
Still, given the large usage of UUIDs, it may be worth adding a codec for this type as part of the default set.