Created
March 22, 2012 14:05
-
-
Save lshoo/2158526 to your computer and use it in GitHub Desktop.
Lift Mapper OneToMany error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Publisher.scala | |
package com.lshoo.liftinaction.model | |
import net.liftweb.mapper._ | |
import net.liftweb.util.Helpers._ | |
import com.lshoo.model.Book | |
class Publisher extends LongKeyedMapper[Publisher] | |
with CreatedUpdated with IdPK | |
with OneToMany[Long, Publisher]{ | |
def getSingleton = Publisher | |
object name extends MappedString(this, 200) | |
object description extends MappedText(this) | |
object books extends MappedOneToMany(Book, Book.publisher) | |
} | |
object Publisher extends Publisher with LongKeyedMetaMapper[Publisher] { | |
override def dbTableName = "publishers" | |
} | |
//end Publisher.scala | |
//Book.scala | |
package com.lshoo.model | |
import net.liftweb.mapper._ | |
import net.liftweb.util.Helpers._ | |
class Book extends LongKeyedMapper[Book] | |
with CreatedUpdated with IdPK | |
{ | |
def getSingleton = Book | |
object title extends MappedString(this, 200) | |
object blurb extends MappedString(this, 200) | |
object publishedOn extends MappedDate(this) | |
object publisher extends MappedLongForeignKey(this, Publisher) { | |
override def dbColumnName = "publisher_id" | |
} | |
} | |
object Book extends Book with LongKeyedMetaMapper[Book] { | |
override def dbTableName = "books" | |
} | |
在两个object publisher...和object books中eclipse报错。哪里写错了? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
犯了低级错误,把其它项目的scala复制到当前项目中,但包没有改过来(Publisher.scala中package com.lshoo.liftinaction.model),去掉liftinaction即可。