MappedStringIndexがMapperのフィールドリストに含まれていないのはなぜですか

StackOverflow https://stackoverflow.com/questions/8342546

  •  27-10-2019
  •  | 
  •  

質問

マッパーの文字列を主キーとして持っているのに、なぜ MappedStringIndexは表示されていません 経由で取得されるすべてのフィールドのリストで Mapper's allFields 方法

私のマッパーはこのようになります...

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 リスト

役に立ちましたか?

解決

(任意のデータタイプの)プライマリキーフィールドはです 含まれていない 返されたリストに allFileds マッパーの方法。

必要に応じて、フィールドを個別に準備できます

何かのようなもの

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

// Now fieldList is having the primaryKey along with other fields.
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top