gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 02:20:45 24 4
gpt4 key购买 nike

在Mapper 中以String 作为主键,为什么在通过 Mapper's allFields 获取的所有字段列表中未显示MappedStringIndex方法

我的 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 中列表

最佳答案

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.

关于lift - 为什么 MappedStringIndex 不包含在 Mapper 的 fieldList 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8342546/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com