4

I'm trying to implement securesocial (authentication plugin for Play2) using slick.

The problem I'm having is that I want to store everything in the same table, but there are a couple of entities that are case classes that should be sub entities of the User. See the problem: https://github.com/leon/securesocial/blob/slick-demo/samples/scala/slick/app/models/User.scala#L63-L96

My question is how should I do the mapping of the columns so that they correctly get converted into their respective case classes where the case classes are nested under another case class?

The same problem goes when converting a single column into a case class https://github.com/leon/securesocial/blob/slick-demo/samples/scala/slick/app/models/User.scala#L61

Where I got it working with MappedTypeMapper.base but I'm unsure if this is the correct way to go. https://github.com/leon/securesocial/blob/slick-demo/samples/scala/slick/app/models/User.scala#L61

Any suggestions would be appreciated!

Leon Radley
  • 7,596
  • 5
  • 35
  • 54
  • 1
    I asked kind of the same question and got a good answer. See http://stackoverflow.com/questions/15627981/mapped-projection-with-companion-object-in-slick – jans Apr 02 '13 at 14:18
  • 1
    isn't the [provided answer on the google group](https://groups.google.com/d/msg/scalaquery/lILmZwTEhLA/5U53bIBhsKAJ) the right one? I would have given the same: make custom apply/unapply methods for your User case class. – Mortimer Apr 26 '13 at 23:25

0 Answers0