为什么MappedStringIndex不包含在Mapper中的fieldList中

时间:2011-12-01 14:02:03

标签: lift mapper

在Mapper中将String作为主键,为什么在 Mapper's allFields方法 <获取的所有字段的列表中 MappedStringIndex未显示 / p>

My Mapper就是这样......

class DummyMapper extends KeyedMapper[String,DummyMapper] {

  def getSingleton = DummyMapper
  def primaryKeyField = dummyCode

  object dummyCode extends MappedStringIndex(this,5)
  {
    override def writePermission_? = true
    override def dbAutogenerated_? = false
    override def dbNotNull_? = true
    override def dbColumnName="dummy_code"
  }
.....

我甚至尝试过包括在fieldOrder中。结果仍然相同,DummyMapper.allFields列表

中没有显示

1 个答案:

答案 0 :(得分:2)

主要字段(任何数据类型)在Mapper的allFileds方法返回的列表中不包含

如果需要,可以单独添加字段

类似

   var myMapperPrimaryKey=DummyMapper.primaryKeyField
   var fieldList=DummyMapper.allFields.toBuffer[BaseField]
   fieldList.prepend(myMapperPrimaryKey)

// Now fieldList is having the primaryKey along with other fields.