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.
Created a workaround for this, but it's far better to be fixed in Sql2o: https://github.com/aaberg/sql2o/issues/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>
withT getId()
method. When a class implements this interface, Kotlin compiler outputs twogetId()
methods: one that returnsObject
and the other which returnsT
(the same with setters,setId(Object)
andsetId(T)
.The problem is in
PojoMetadata:117
cycle: JVM lists those fields in random order, and sometimes theT
-typed one wins, and sometimes theObject
-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.