I am trying to insert into mongo DB and am getting the following error when I try and insert a joda big money object

"can't serialize class org.joda.money.BigMoney"

however according to the java doc BigMoney does implement serializable ( http://www.joda.org/joda-money/apidocs/org/joda/money/BigMoney.html )

Why would this error occur when serializable is implemented?

没有正确的解决方案

其他提示

The Java driver can only serialise simple primitive types not complex ones - it's not using Java serialisation.

If you want to use Joda money you'll have to do the conversion yourself from the BigMoney object into one (or likely more) primitive values that the driver understands.

This will get a lot easier in the 3.x version of the driver, but for now those are your options.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top