Phantom DSL modeling case classes

447 views Asked by At

I know scala and/or JVM have a limitation with 22 more fields on case classes and the best way is to split into more than one case class eg:

case class User(id: Long, username: String, password: String, address: Address)
case class Address(id: Long, street: String, city: String)

But looking at phantom dsl documentation, all docs and examples points to a single case class.

The only exception I can see, is using JsonTable showing in this test.

https://github.com/websudos/phantom/blob/develop/phantom-dsl/src/test/scala/com/websudos/phantom/tables/JsonTable.scala

The question is... how can I model inner case class using phantom-dsl for large tables?

EDIT

Just to be clear they object I'm trying to mapping into phantom.

Imagine a cassandra table with 30, 40 fields. How should I map table using case classes? Since I will receive those fields by json through a rest service, is the JsonTable example the correct approach?

1

There are 1 answers

0
Thiago Pereira On BEST ANSWER

Since scala 2.11 does not have anymore case classes 22 fields limitation, you can declare all of your fields flat or use the jsonTable examples to abstract the structure.