[英]Salat MongoDB argument type mismatch
I have a case class that I map to the Salat library using the SalatDAO extentions. 我有一个使用SalatDAO扩展映射到Salat库的案例类。 In this case class, one of the parameters is an Enum type.
在这种情况下,类的参数之一是Enum类型。 When I run it to fetch the data from the database, I get the following error:
当我运行它以从数据库中获取数据时,出现以下错误:
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
------------------------------------------------------------
Here is the Enum object that has the Salat annotations. 这是具有Salat批注的Enum对象。 Am I missing something?
我想念什么吗?
@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")
}
The error message of 错误消息
---------- 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
suggests that you are expecting an enumeration value but the database contains an Option[Enumeration.Value]
. 建议您期望一个枚举值,但是数据库包含
Option[Enumeration.Value]
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.