2009-12-02 78 views
2

我正在使用JDK 1.6.0_16和Scala 2.7.7編譯maven。非法繼承編譯錯誤使用Scala 2.7.7和LIFT 1.1-SNAPSHOT

我做mvn clean compile,我得到四個錯誤,但它們是相同的,不同的型號:

[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] {

這是我的代碼:

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中安裝了夜間插件,所以我不能安裝IDE 2.7.7,所以我只能用maven編譯它。

我的使用方法CRUDify有問題嗎?

回答

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) 
} 
+0

謝謝。自從我開始轉向使用JPA以來,我會看到我有什麼問題。 :)並使用LIFT 1.1。 – 2009-12-12 04:39:34

0

當我回到使用LIFT 1.0而不是1.1時,我終於正常工作。看起來我最終需要對1.1進行一些修改,但至少我可以繼續我的開發。