Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sql2o sometimes won't use Converter #10

Closed
mvysny opened this issue Jan 21, 2019 · 2 comments
Closed

Sql2o sometimes won't use Converter #10

mvysny opened this issue Jan 21, 2019 · 2 comments
Assignees
Labels
bug Something isn't working waiting for upstream This is a bug in a library dependency

Comments

@mvysny
Copy link
Owner

mvysny commented Jan 21, 2019

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.

@mvysny mvysny self-assigned this Jan 21, 2019
@mvysny mvysny added bug Something isn't working waiting for upstream This is a bug in a library dependency labels Jan 21, 2019
@mvysny
Copy link
Owner Author

mvysny commented Jan 21, 2019

Blocked by aaberg/sql2o#314

mvysny added a commit that referenced this issue Jan 28, 2019
@mvysny
Copy link
Owner Author

mvysny commented Jan 23, 2024

Closed since we no longer use SQL2o behind the scenes: we replaced it with JDBI.

@mvysny mvysny closed this as completed Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for upstream This is a bug in a library dependency
Projects
None yet
Development

No branches or pull requests

1 participant