importing model - permanently hidden?

777 views
Skip to first unread message

bradford

unread,
Mar 29, 2009, 2:23:17 PM3/29/09
to Lift
I have two models in separate .scala files. One of them is a
ForeignKey to the other. The problem I'm having is that it won't let
me import the Foreign model, since I have not defined a companion
object. And if I do define a companion object, I get a NetBeans
warning saying, "imported `Courses` is permanently hidden by
definition of object Courses in package model.

What do I need to change?

=== Courses.scala ===
package com.n.hello.model

import _root_.net.liftweb.mapper._

class Courses extends KeyedMapper[Long, Courses] {
def primaryKeyField = id

object id extends MappedLongIndex(this)
object name extends MappedString(this, 25)
}

object Courses extends Courses with KeyedMetaMapper[Long, Courses] {

}

=== Teachers.scala ===
package com.n.hello.model

import _root_.net.liftweb.mapper._
// import model.Courses // <-- problem if I add this line w/ or w/out
companion object defined in Courses

class Teachers extends KeyedMapper[String, Teachers] {
def primaryKeyField = nick

object nick extends MappedStringIndex(this, 10)
object course_id extends MappedLongForeignKey(this, Courses)
}


Derek Chen-Becker

unread,
Mar 30, 2009, 1:26:49 AM3/30/09
to lif...@googlegroups.com
I don't have an answer, but does it work if you import model._ ?

Derek

bradford

unread,
Mar 30, 2009, 9:33:57 AM3/30/09
to Lift
I haven't tried it. I just defined the companion objects and removed
the import statement and everything is working now. Thanks for your
reply, Derek.

On Mar 30, 1:26 am, Derek Chen-Becker <dchenbec...@gmail.com> wrote:
> I don't have an answer, but does it work if you import model._ ?
>
> Derek
>
Reply all
Reply to author
Forward
0 new messages