why does MappedStringIndex not included in fieldList in Mapper
سؤال
In Mapper's having String as a primary Key, why is the MappedStringIndex not shown in the list of all fields that are obtained via the Mapper's allFields
method
My Mapper goes like this ...
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"
}
.....
I even tried it including in the fieldOrder
. Still the result was same, it din't showed up in DummyMapper.allFields
list
المحلول
primarykey fields ( of any data-type ) are not included in the list returned by allFileds
method of the Mapper.
You can prepend the field separately if you want
something like
var myMapperPrimaryKey=DummyMapper.primaryKeyField
var fieldList=DummyMapper.allFields.toBuffer[BaseField]
fieldList.prepend(myMapperPrimaryKey)
// Now fieldList is having the primaryKey along with other fields.
لا تنتمي إلى StackOverflow