Search code examples
liftscala-2.7

Illegal inheritance compilation error using Scala 2.7.7 and LIFT 1.1-SNAPSHOT


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?


Solution

  • 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)
    }