2

我正在使用 JDK 1.6.0_16 和 Scala 2.7.7,使用 maven 进行编译。

我这样做mvn clean compile了,我得到了四个错误,但它们是相同的,在不同的模型中:

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

[INFO] self-type jblack.resumeapp.lift.model.ContactInfoModel 不符合 net.liftweb.mapper.CRUDify[Long,jblack.resumeapp.lift.model.ContactInfoModel] 的 selftype net.liftweb.mapper.CRUDify[ Long,jblack.resumeapp.lift.model.ContactInfoModel] 与 jblack.resumeapp.lift.model.ContactInfoModel 与 net.liftweb.map per.KeyedMetaMapper[Long,jblack.resumeapp.lift.model.ContactInfoModel]

[INFO] 与 CRUDify[Long, ContactInfoModel] {

这是我的代码:

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吗?

4

2 回答 2

2

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)
}
于 2009-12-11T19:36:56.980 回答
0

当我回到使用 LIFT 1.0 而不是 1.1 时,我终于让它正常工作了。看来我最终需要针对 1.1 进行一些更改,但至少我可以继续我的开发。

于 2009-12-04T02:08:01.057 回答