Tuesday, 1 April 2014

Map estate in pointy 2.0

I know there are other questions in smoke-stack overflow, though None of
them works for me.I'm perplexing to map a rudimentary estate in pointy
projectionI try hundreds of combinations, we can't make this compile. we
finish of with a follow formula and a blunder bellow. we foster a box
classes since they have many some-more data. Without estate my other
layers (controllers, services and interface) will have to understanding
with complexity, since in this box a denote represents genuine objects
that are in trisect inherited, there is no improved illustration that
estate for this classes. In a use and controller covering we make a Json
illustration of a classes be exacted what we need, we can send and devour
a Json API that represents my model, a wholly thing in a proceed is
nutritious this illustration in relational database, my relational denote
is able of insist this entities in an unparalleled list inheritance,
though interpret rows to relational is a pain.I'm controlling scala 2.10.3
+ sbt 0.13.1 summary category Pessoa2(val nome:String, val
tipo:String)case category PessoaFisica2(override val nome:String, val
cpf:String) extends Pessoa2(nome,"F")case category
PessoaJuridica2(override val nome:String, val cnpj:String) extends
Pessoa2(nome, "J")class PessoaTable(tag: Tag) extends Table[Pessoa2](tag,
"PESSOAS"){// def id = column[Int]("ID", O.PrimaryKey, O.AutoInc)def
nome = column[String]("nome")def tipo = column[String]("tipo")def cpf =
column[String]("CPF", O.Nullable)def cnpj = column[String]("CNPJ",
O.Nullable)def * = (nome, tipo, cpf.?, cnpj.?) <> ({ box
(nome:String,"F",cpf:Option[String],_) => new PessoaFisica2(nome,
cpf.get):Pessoa2 box (nome:String,"J",_,cnpj:Option[String]) => new
PessoaJuridica2(nome, cnpj.get):Pessoa2 },{ box PessoaFisica2(nome,
Some(cpf)) => Some((nome, "F", cpf, "")) box PessoaJuridica2(nome,
Some(cnpj)) => Some((nome, "J", "", cnpj)) })}This ends with a error: The
justification forms of an opposite duty contingency be entirely known.
(SLS 8.5)[error] Expected form was: ? => ?[error] def * = (nome, tipo,
cpf.?, cnpj.?) <> ({[error]
^[error]
/Users/giovanni/Projetos/atende/clientes/app/model/Pessoas.scala:158: form
mismatch;[error] found : Any[error] required: String[error]
box (nome,"F",cpf,_) => new PessoaFisica2(nome, cpf):Pessoa2[error]
^[error]
/Users/giovanni/Projetos/atende/clientes/app/model/Pessoas.scala:158: form
mismatch;[error] found : Any[error] required: String[error]
box (nome,"F",cpf,_) => new PessoaFisica2(nome, cpf):Pessoa2[error]
^[error]
/Users/giovanni/Projetos/atende/clientes/app/model/Pessoas.scala:159: form
mismatch;[error] found : Any[error] required: String[error]
box (nome,"J",_,cnpj) => new PessoaJuridica2(nome, cnpj):Pessoa2[error]
^[error]
/Users/giovanni/Projetos/atende/clientes/app/model/Pessoas.scala:159: form
mismatch;[error] found : Any[error] required: String[error]
box (nome,"J",_,cnpj) => new PessoaJuridica2(nome, cnpj):Pessoa2[error]
^[error]
/Users/giovanni/Projetos/atende/clientes/app/model/Pessoas.scala:160:
blank parameter form for stretched function[error] The justification forms
of an opposite duty contingency be entirely known. (SLS 8.5)[error]
Expected form was: ? => Option[?][error] },{[error]
^[error]
/Users/giovanni/Projetos/atende/clientes/app/model/Pessoas.scala:157: No
relating Shape found.[error] Slick does not know how to map a given
types.[error] Possible causes: T in Table[T] does not review your *
projection. Or we use an unsupported form in a Query (e.g. scala
List).[error] Required level: scala.slick.lifted.ShapeLevel.Flat[error]
Source type: (scala.slick.lifted.Column[String],
scala.slick.lifted.Column[String],
scala.slick.lifted.Column[Option[String]],
scala.slick.lifted.Column[Option[String]])[error] Unpacked type:
(String, String, String, String)[error] Packed type: Any[error]
def * = (nome, tipo, cpf.?, cnpj.?) <> ({[error]
^[error] 7 errors found

No comments:

Post a Comment