About updating on scala scaleikejdbc

Asked 1 years ago, Updated 1 years ago, 92 views

We are developing at scala.
I wanted to process CRUD with code created automatically by scalikejdbc.
Only update statements are not allowed.

 object hoge extensions SQLSyntaxSupport [hoge] {
  def save(entity:hoge)(implicit session:DBSession=autoSession):hoge={
    withSQL{
      update(hoge).set(
        column.id ->entity.id,
        column.test ->entity.test
      ) .where.eq (column.id, entity.id)
    }.update.apply()
    entity
  }
}

Please process the controller part in MVC.
Please tell me how to handle this.
The environment is now available in

  • Mac OS X
  • scala+play framework

That's it.

scala playframework scalikejdbc

2022-09-30 14:11

1 Answers

If you don't ask more specifically, it will be difficult for the respondents to understand where they don't understand in the first place, so first of all, there is a sample of the scalikejdbc itself combined with play, so the code below and

Model side code
- https://github.com/scalikejdbc/hello-scalikejdbc/blob/d9be942770a1e815e1d6626c79b471fa4a7036ce/app/models/Programmer.scala

The code on the controller side of the play using it
- https://github.com/scalikejdbc/hello-scalikejdbc/blob/d9be942770a1e815e1d6626c79b471fa4a7036ce/app/controllers/Programmers.scala

I think it would be better if you read and study the official documents of play and then ask them to ask you more specific questions or change the questions to more specific ones.

Or, if it's a code that can reveal everything for study, I don't mind if it's in the middle, so I'd like you to reveal the whole code and see it.


2022-09-30 14:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.