Salat MongoDB参数类型不匹配



我有一个案例类,我使用 SalatDAO 扩展映射到 Salat 库。在本例类中,其中一个参数是枚举类型。当我运行它以从数据库中获取数据时,出现以下错误:

com.novus.salat.util.ToObjectGlitch: 
  argument type mismatch
  $anon$2(class domain.content.Question @ com.novus.salat.global.package$$anon$1@294ce5eb) toObject failed on:
  SYM: domain.content.Question
  CONSTRUCTOR
public domain.content.Question(int,java.lang.String,scala.collection.immutable.List<domain.content.Answer>,scala.Enumeration$Value,boolean)
---------- CONSTRUCTOR EXPECTS FOR PARAM [0] --------------
NAME:         id
TYPE:         int
DEFAULT ARG   [Missing, but unnecessary because input value was supplied]
@Ignore       false
---------- CONSTRUCTOR INPUT ------------------------
TYPE: java.lang.Integer
VALUE:
1001
------------------------------------------------------------

---------- CONSTRUCTOR EXPECTS FOR PARAM [1] --------------
NAME:         text
TYPE:         java.lang.String
DEFAULT ARG   [Missing, but unnecessary because input value was supplied]
@Ignore       false
---------- CONSTRUCTOR INPUT ------------------------
TYPE: java.lang.String
VALUE:
Which is a valid java access modifier?
------------------------------------------------------------

---------- CONSTRUCTOR EXPECTS FOR PARAM [2] --------------
NAME:         answers
TYPE:         scala.collection.immutable.List<domain.content.Answer>
DEFAULT ARG   [Missing, but unnecessary because input value was supplied]
@Ignore       false
---------- CONSTRUCTOR INPUT ------------------------
TYPE: scala.collection.immutable.$colon$colon[B]
VALUE:
List(Answer(1,private,true,None), Answer(2,personal,false,None), Answer(3,protect,false,None), Answe...
------------------------------------------------------------

---------- CONSTRUCTOR EXPECTS FOR PARAM [3] --------------
NAME:         quesType
TYPE:         scala.Enumeration$Value
DEFAULT ARG   [Missing, but unnecessary because input value was supplied]
@Ignore       false
---------- CONSTRUCTOR INPUT ------------------------
TYPE: scala.None$[scala.runtime.Nothing$]
VALUE:
None
------------------------------------------------------------

---------- CONSTRUCTOR EXPECTS FOR PARAM [4] --------------
NAME:         isSourceCodeAvailable
TYPE:         boolean
DEFAULT ARG   [Missing, but unnecessary because input value was supplied]
@Ignore       false
---------- CONSTRUCTOR INPUT ------------------------
TYPE: java.lang.Boolean
VALUE:
false
------------------------------------------------------------

下面是具有 Salat 注释的 Enum 对象。我错过了什么吗?

@EnumAs(strategy = EnumStrategy.BY_ID)
object QuestionTypeEnum extends Enumeration {
  val MULTI_CHOICE = Value("MULTI_CHOICE")
  val RADIO_BUTTON = Value("RADIO_BUTTON")
  val DRAG_AND_DROP = Value("DRAG_AND_DROP")
}

的错误消息

---------- CONSTRUCTOR EXPECTS FOR PARAM [3] --------------
NAME:         quesType
TYPE:         scala.Enumeration$Value
DEFAULT ARG   [Missing, but unnecessary because input value was supplied]
@Ignore       false
---------- CONSTRUCTOR INPUT ------------------------
TYPE: scala.None$[scala.runtime.Nothing$]
VALUE:
None

建议你期待一个枚举值,但数据库包含一个Option[Enumeration.Value]

相关内容

  • 没有找到相关文章

最新更新