I ended up writing my own data type that gets the ...
# komapper
d
I ended up writing my own data type that gets the clob as a string... but what about having a data type that depends on an annotation instead of a new class? Say:
Copy code
@KomapperEntity
data class FooEntity(@KomapperType(ClobStringType::class) val sometext: String)
t
I would like to recommend another way. How about converting
java.sql.Clob
to your own data type. I think you can use Data type conversion. https://www.komapper.org/docs/reference/data-type/#data-type-conversion
d
It's not easy to create one from a string, you need a connection... Does a mapper have one?
t
Ah, I see. Then, perhaps a user-defined data type might be more suitable. You can get a Connection from the PreparedStatement parameter of the setValue function. https://www.komapper.org/docs/reference/data-type/#user-defined-data-types-for-jdbc
d
Yeah, but it's a bit of a waste to have to create all those extra wrapper objects -- unless user defined data types can use value classes? But that would still mean to access these fields indirectly through the value class's property...
Nope, it seems like value classes ignore the user defined data types...