Sql2o sometimes won't use Converter
Closed this issue · 2 comments
Created a workaround for this, but it's far better to be fixed in Sql2o: aaberg/sql2o#314
There is a subtle bug in Sql2o which sometimes misdetects the property type. The problem is as follows.
I have an interface Entity<T>
with T getId()
method. When a class implements this interface, Kotlin compiler outputs two getId()
methods: one that returns Object
and the other which returns T
(the same with setters, setId(Object)
and setId(T)
.
The problem is in PojoMetadata:117
cycle: JVM lists those fields in random order, and sometimes the T
-typed one wins, and sometimes the Object
-typed wins. That then causes Sql2o to not to pick up a proper converter for that field, and the setter fails.
I've created a workaround for this, in the MysqlQuirks
class, but it's better to fix this properly in Sql2o.
Blocked by aaberg/sql2o#314
Closed since we no longer use SQL2o behind the scenes: we replaced it with JDBI.