skinny-framework / skinny-framework

:monorail: "Scala on Rails" - A full-stack web app framework for rapid development in Scala

Home Page:https://skinny-framework.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

implicit ParameterBinderFactory/Binders not being used as expected

emanresusername opened this issue · comments

the core of the problem scenario and some code snippets are here with a possible upstream fix lead here . but even with those issues resolved. all variations of

Model.udpateById(id).withAttributes('specialType -> SpecialType.Free)
Model.findById(id).foreach(_.copy(specialType = Option(SpecialType.Beer)).save)
// etc . . .

give me the following error

[run-main-0] ERROR scalikejdbc.StatementExecutor$$anon$1 - SQL execution failed (Reason: Incorrect string value: '\xAC\xED\x00\x05sr...' for column 'specialType' at row 1):

i can't seem to step into the same lines that show up in the stack trace, so not sure if some of the magic is happening in macros or different thread pools, or what, but my best guess was it's something like what's going on here

The pair, Symbol and value, doesn't support ParameterBinderFactory's type-safety. If you need more type-safety, consider directly using ScalikeJDBC's QueryDSL more.

if i wanted to attempt a PR to make the Model#save functionality work in this situation, is there a particularly good place to start looking in the code base here? Was i on the right track with the toSerializeable function or would work need to happen at the scalike-jdbc layer first?

I'm afraid that it's impossible to enable ParameterBinderFactory without introducing breaking changes to skinny-orm APIs. I don't have a plan to do that at least in the near future.

ok cool, that's fair