使用 Scala 2.7.7 和 LIFT 1.1-SNAPSHOT 出现非法继承编译错误

发布于 2024-08-13 13:06:28 字数 1539 浏览 4 评论 0原文

我使用的是 JDK 1.6.0_16 和 Scala 2.7.7,使用 maven 编译。

我执行 mvn cleancompile 并收到四个错误,但它们在不同的模型中是相同的:

[错误] C:\Users\owner\workspace\ResumeApp\src\main\scala\jblack\resumeapp\lift\ 模型 \ContactInfoModel.scala:13: 错误:非法继承;

[INFO]自我类型 jblack.resumeapp.lift.model.ContactInfoModel 不符合 net.liftweb.mapper.CRUDify[长,jblack.resumeapp.lift.model.ContactInfoModel] 的自我类型 net.liftweb.mapper.CRUDify[长,jblack.resumeapp.lift.model.ContactI nfoModel] 与 jblack.resumeapp.lift.model.ContactInfoModel 与 net.liftweb.map per.KeyedMetaMapper[长,jblack.resumeapp.lift.model.ContactInfoModel]

[信息] 与 CRUDify[长, 联系信息模型] {

这是我的代码:

package jblack.resumeapp.lift.model

import net.liftweb.mapper._

object ContactInfoMetaData 
    extends ContactInfoModel 
        with KeyedMetaMapper[Long, ContactInfoModel] {
    override def dbTableName = "contactinfo"
    override def fieldOrder = List(key, data, display) 
}
class ContactInfoModel 
    extends KeyedMapper[Long, ContactInfoModel] 
        with CRUDify[Long, ContactInfoModel] {
    def getSingleton = ContactInfoMetaData
    def primaryKeyField = id

    object id extends MappedLongIndex(this)
    object key extends MappedString(this, 100)
    object data extends MappedString(this, 100)
    object display extends MappedBoolean(this)
}

我不确定我做错了什么。

不幸的是,因为我在Eclipse中安装了nightly插件,所以我无法安装IDE 2.7.7,所以我只能用maven编译它。

我使用 CRUDify 的方式有问题吗?

I am using JDK 1.6.0_16, and Scala 2.7.7, compiling with maven.

I do mvn clean compile and I get four errors, but they are identical, in different models:

[ERROR]
C:\Users\owner\workspace\ResumeApp\src\main\scala\jblack\resumeapp\lift\
model\ContactInfoModel.scala:13:
error: illegal inheritance;

[INFO] self-type
jblack.resumeapp.lift.model.ContactInfoModel
does not conform to
net.liftweb.mapper.CRUDify[Long,jblack.resumeapp.lift.model.ContactInfoModel]
's selftype
net.liftweb.mapper.CRUDify[Long,jblack.resumeapp.lift.model.ContactI
nfoModel] with
jblack.resumeapp.lift.model.ContactInfoModel
with net.liftweb.map
per.KeyedMetaMapper[Long,jblack.resumeapp.lift.model.ContactInfoModel]

[INFO] with CRUDify[Long,
ContactInfoModel] {

And this is my code:

package jblack.resumeapp.lift.model

import net.liftweb.mapper._

object ContactInfoMetaData 
    extends ContactInfoModel 
        with KeyedMetaMapper[Long, ContactInfoModel] {
    override def dbTableName = "contactinfo"
    override def fieldOrder = List(key, data, display) 
}
class ContactInfoModel 
    extends KeyedMapper[Long, ContactInfoModel] 
        with CRUDify[Long, ContactInfoModel] {
    def getSingleton = ContactInfoMetaData
    def primaryKeyField = id

    object id extends MappedLongIndex(this)
    object key extends MappedString(this, 100)
    object data extends MappedString(this, 100)
    object display extends MappedBoolean(this)
}

I am not certain what I am doing wrong.

Unfortunately, because I installed the nightly plugin, into Eclipse, I can't install IDE 2.7.7, so I can only compile this with maven.

Is there a problem with how I am using CRUDify?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦魇绽荼蘼 2024-08-20 13:06:28

lift-1.1中的CRUDify需要混合到MetaMapper对象而不是Mapper类中。所以它应该使用以下代码:

package jblack.resumeapp.lift.model

import net.liftweb.mapper._

object ContactInfoMetaData 
    extends ContactInfoModel 
        with KeyedMetaMapper[Long, ContactInfoModel]
        with CRUDify[Long, ContactInfoModel] {
    override def dbTableName = "contactinfo"
    override def fieldOrder = List(key, data, display) 
}
class ContactInfoModel 
    extends KeyedMapper[Long, ContactInfoModel] {
    def getSingleton = ContactInfoMetaData
    def primaryKeyField = id

    object id extends MappedLongIndex(this)
    object key extends MappedString(this, 100)
    object data extends MappedString(this, 100)
    object display extends MappedBoolean(this)
}

CRUDify in lift-1.1 needs to be mixed into the MetaMapper object instead of the Mapper class. So it should work with this code instead:

package jblack.resumeapp.lift.model

import net.liftweb.mapper._

object ContactInfoMetaData 
    extends ContactInfoModel 
        with KeyedMetaMapper[Long, ContactInfoModel]
        with CRUDify[Long, ContactInfoModel] {
    override def dbTableName = "contactinfo"
    override def fieldOrder = List(key, data, display) 
}
class ContactInfoModel 
    extends KeyedMapper[Long, ContactInfoModel] {
    def getSingleton = ContactInfoMetaData
    def primaryKeyField = id

    object id extends MappedLongIndex(this)
    object key extends MappedString(this, 100)
    object data extends MappedString(this, 100)
    object display extends MappedBoolean(this)
}
冷月断魂刀 2024-08-20 13:06:28

当我重新使用 LIFT 1.0 而不是 1.1 时,我终于让它正常工作了。看来我最终需要研究 1.1 的一些变化,但至少我可以继续我的开发。

I finally got it working properly when I went back to using LIFT 1.0 instead of 1.1. It appears that there is some change that I need to eventually look into for 1.1, but at least I can continue with my development.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文