mapper是否允许在模型中创建复合键?如果是,请举个例子。
答案 0 :(得分:1)
这是一个例子:
class FooBar extends LongKeyedMapper[FooBar] {
def getSingleton = FooBar
def primaryKeyField = id
object id extends MappedLongIndex(this)
object foo extends MappedLongForeignKey(this, Foo)
object bar extends MappedLongForeignKey(this, Bar)
}
object FooBar extends FooBar with LogKeyedMetaMapper[FooBar] {
override def dbIndexes = Index(foo, bar) :: super.dbIndexes
}
的示例