Search code examples
scalasqueryl

Do any of the Scala ORM's implement code generation from SQL -> Scala?


I am using Squeryl as an ORM with MySQL. This is a new project working with existing schemas that contain several hundred tables.

As far as I can tell, neither Squeryl nor any of the available Scala ORMs can generate the O (Scala classes) from the R (mysql tables). I suppose it wouldn't be too hard to roll my own by crawling the information schema, but I'd rather not duplicate that effort if someone else has already done so.

I'm also curious if anyone can tell me why the R->O direction is so often neglected. In my experience, O->R is the exception and not the rule.

I'll probably start down the path of rolling my own solution. If that's anywhere near complete before I hear of another option, I'll post a link to that code.

Thanks.


Solution

  • QueryDSL provides you with a utility, that can generate code from existing tables. You would however need to accept, that it's primarily a Java lib, and Scala is treated only as an extension there.

    I guess the support for R-O is just a matter of time and users' feedback.