光滑的错误:类型 TupleXX 不是包 scala 的成员 (XX > 22) [英] slick error : type TupleXX is not a member of package scala (XX > 22)

查看:55
本文介绍了光滑的错误:类型 TupleXX 不是包 scala 的成员 (XX > 22)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用提升的光滑编写一个数据库模式.我有超过 100 列的大表.所以我对所有超过 22 列的表都有这个错误:

I want to write a database schema using lifted slick. I have huge tables with more than 100 columns. So i have this error for all the tables that exceed 22 columns :

类型 Tuple45 不是包 scala 的成员

type Tuple45 is not a member of package scala

这是其中一张表的代码:

Here is the code of one of the tables :

object adrepost extends Table[(String, String, String, String, String, String, String,   String, String, String, String, String, String, String, String, String, String, Date, Boolean, Date, Int, Boolean, String, String, String, String, String, Boolean, Boolean, String, String, Boolean)]("ADREPOST") {

def codeadrp = column[String]("CODEADRP", O.PrimaryKey, O.NotNull,O.DBType("VARCHAR(7)"))
def codecivi = column[String]("CODECIVI", O.NotNull, O.DBType("VARCHAR(3)"))
def nom1 = column[String]("NOM1", O.NotNull, O.DBType("VARCHAR(32)"))
def nom2 = column[String]("NOM2", O.NotNull, O.DBType("VARCHAR(32)"))
def complt1 = column[String]("COMPLT1", O.NotNull, O.DBType("VARCHAR(32)"))
def complt2 = column[String]("COMPLT2", O.NotNull, O.DBType("VARCHAR(32)"))
def voienum = column[String]("VOIENUM", O.NotNull, O.DBType("VARCHAR(10)"))
def voienom = column[String]("VOIENOM", O.NotNull, O.DBType("VARCHAR(32)"))
def codepays = column[String]("CODEPAYS", O.NotNull, O.DBType("VARCHAR(3)"))
def codecpced = column[String]("CODECPCED", O.NotNull, O.DBType("VARCHAR(10)"))
def codeinsee = column[String]("CODEINSEE", O.NotNull, O.DBType("VARCHAR(10)"))
def codeetat = column[String]("CODEETAT", O.NotNull, O.DBType("VARCHAR(8)"))
def telephone = column[String]("TELEPHONE", O.NotNull, O.DBType("VARCHAR(18)"))
def telephone2 = column[String]("TELEPHONE2", O.NotNull, O.DBType("VARCHAR(18)"))
def telecopie = column[String]("TELECOPIE", O.NotNull, O.DBType("VARCHAR(18)"))
def email = column[String]("EMAIL", O.NotNull, O.DBType("VARCHAR(64)"))
def argument = column[String]("ARGUMENT", O.NotNull, O.DBType("VARCHAR(16)"))
def ddn_crea = column[Date]("DDN_CREA")
def top_robins = column[Boolean]("TOP_ROBINS", O.NotNull)
def dat_maj = column[Date]("DAT_MAJ", O.NotNull)
def nb_npai = column[Int]("NB_NPAI", O.NotNull)
def top_noloca = column[Boolean]("TOP_NOLOCA", O.NotNull)
def siren = column[String]("SIREN", O.NotNull, O.DBType("VARCHAR(9)"))
def nic = column[String]("NIC", O.NotNull, O.DBType("VARCHAR(5)"))
def codenaf = column[String]("CODENAF", O.NotNull, O.DBType("VARCHAR(5)"))
def id_fiscale = column[String]("ID_FISCALE", O.NotNull, O.DBType("VARCHAR(15)"))
def matchcode = column[String]("MATCHCODE", O.NotNull, O.DBType("VARCHAR(18)"))
def top_erobin = column[Boolean]("TOP_EROBIN", O.NotNull)
def top_seg = column[Boolean]("TOP_SEG", O.NotNull)
def codelang = column[String]("CODELANG", O.NotNull, O.DBType("VARCHAR(3)"))
def codeutil = column[String]("CODEUTIL", O.NotNull, O.DBType("VARCHAR(3)"))
def inactivee = column[Boolean]("INACTIVEE", O.NotNull)

def * = codeadrp ~ codecivi ~ nom1 ~ nom2 ~ complt1 ~ complt2 ~ voienum ~ voienom ~ codepays ~ codecpced ~ codeinsee ~ codeetat ~ telephone ~ telephone2 ~ telecopie ~ email ~ argument ~ ddn_crea ~ top_robins ~ dat_maj ~ nb_npai ~ top_noloca ~ siren ~ nic ~ codenaf ~ id_fiscale ~ matchcode ~ top_erobin ~ top_seg ~ codelang ~ codeutil ~ inactivee

def idx1 = index("adrepost_argument", (argument), unique = true)
def idx2 = index("adrepost_codecpced", (codecpced), unique = true)
def idx3 = index("adrepost_commune", (codepays, codecpced, codeinsee), unique = true)
def idx4 = index("adrepost_matchcode", (matchcode), unique = true)
def idx5 = index("adrepost_nom1", (nom1), unique = true)
}  

关于如何解决这个问题的任何想法??

Any ideas for how to solve this problem ??

推荐答案

你应该看看使用嵌套元组来解决这个问题.以下帖子对我很有帮助:

You should take a look at using nested tuples to solve this problem. The following post was helpful for me:

https://groups.google.com/forum/#!msg/scalaquery/qjNW8P7VQJ8/ntqCkz0S4WIJ

Stefan 在代码中使用注释来帮助您了解正在执行的操作.

Stefan uses comments in the code to help walk you through what is being done.

旁注:在几周前的 Slick 演讲中,我获悉此限制将在即将发布的下一个版本中得到解决.

Side note: at a Slick talk a couple weeks ago, I was informed that this restriction is being addressed in the next version, which will be released soon.

这篇关于光滑的错误:类型 TupleXX 不是包 scala 的成员 (XX > 22)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆