-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I have a user_notification_preferences table with a profile_type column of type profile_type_enum not null. The profile_type_enum type is defined as:
create type profile_type_enum as enum ('Admin', 'Retailer', 'Supplier');
When trying to deserialize a result containing the profile_type column to a data class' val profileType: ProfileType property, where the ProfileType enum class is defined as:
@Serializable
enum class ProfileType {
Admin, Retailer, Supplier
}
I get the following error:
Caused by: java.lang.IllegalArgumentException: Unsupported kind: ENUM at column:ColumnInfo(name=profile_type, type=profile_type_enum)
RowDecoder.kt:364 io.exoquery.sql.RowDecoder.decodeBestEffortFromDescriptor
RowDecoder.kt:309 io.exoquery.sql.RowDecoder.decodeNullableSerializableElement
RowDecoder.kt:386 io.exoquery.sql.RowDecoder.decodeSerializableElement
UserNotificationPreferences.kt:26 db.dto.UserNotificationPreferencesWithType$$serializer.deserialize
This brings me to believe that enums are not supported yet.
My current workaround is:
- cast it to
textin the sql query - deserilize it to
String - then doe some manual
ProfileType.valueOf(it)to get the enum in Kotlin
Maybe I'm doing something wrong, maybe emun deserialization is simply not implemented yet.
Metadata
Metadata
Assignees
Labels
No labels