2012-08-14 80 views
0

使用Play!在斯卡拉与Squeryl ORM。我不知道是什么原因导致了这个问题,但是当我给Play添加一个新模型时!现在不会有一个很奇怪的错误编译:新的玩法!类编译器错误:“更新不是成员...”

value update is not a member of models.OauthCred

编译器点具体地涉及由Squeryl需要的this()零参数的构造函数。

的代码如下:

case class OauthCred(
    val id: Long, 

    @Column("vendor") 
    val vendor: String, 

    @Column("user_id") 
    val userId: Long, 

    @Column("remote_id") 
    val remoteId: Option[String], 

    @Column("scope") 
    var scope: String, 

    @Column("access_code") 
    var accessCode: Option[String], 

    @Column("unauthorized_token") 
    var unauthorizedToken: Option[String], 

    @Column("authorized_token") 
    var authorizedToken: Option[String], 

    @Column("refresh_token") 
    var refreshToken: Option[String], 

    @Column("is_active") 
    var isActive: Boolean, 

    @Column("is_revoked") 
    var isRevoked: Boolean, 

    @Column("created") 
    val created: Timestamp, 

    @Column("modified") 
    var modified: Timestamp 

) extends KeyedEntity[Long] { 

    this() = this(0L, "", 0L, Some(""), "", Some(""), Some(""), Some(""), Some(""), false, false, new Timestamp(), new Timestamp()) 

} 

object OauthCred { 

    def get(id:Long) = DB.oauthcred.lookup(id) 

    def save(o:OauthCred) = DB.oauthcred.update(o) 

    def getByRemoteId(remoteId:String) = { from(DB.oauthcred)(o => where(o.remoteId === Some(remoteId)) select(o)).headOption } 
} 

可能是什么造成的?

回答

0

问题解决了,它实际上是比我想象的要简单得多:

this()实际上需要的是def this()

希望这有助于未来的用户。