質問

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