score:0

There is not a good solution to this question for current slick version. You can pack some fields into one case class.

Please refer to this test case.

https://github.com/slick/slick/blob/2.1.0-RC1/slick-testkit/src/main/scala/com/typesafe/slick/testkit/tests/JdbcMapperTest.scala#L99

score:0

Actually this could be done via HList like this

def * = (col1 :: col2 :: .. :: HNil).shaped <> (
{ case x => new YYY(x(0), x(1), ..)}, 
{ x: YYY => Option(x.col1 :: x.col2 :: .. :: HNil)}
)

I've written an macro to do the mapping, you may take a look at this https://github.com/jilen/slickext

score:0

I have a HListCaseClassShape that works exactly like the CaseClassShape but without the 22 column limit: here. You could then map it to your table like this: def * = MyHListCaseClassShape(f1, f2, f3...) (see the Pair * example here). Not sure if it'll work with Slick 2 but might be worth a shot.


Related Query

More Query from same tag