java - Morphia ArrayStoreException BigDecimal and Integer Array -


I get the following stack trace while retrieving a document. The document contains a buggy field that is successfully parsed while running on the debugger. However, the program crash when parsing an array of five integers.

I keep in mind the use of the commercial because there are other posts mentioning BigDisk and Arraystore exposition.

This error indicates that the array is being parsed in a list.

If I write POJO from Java code, error is never seen.

> But, if I add BigDecimal as a string it shows this error.

How do I solve this?

  java.lang.System.arraycopy (Native Method java.util.ArrayList.toArray exception "main" java.lang.ArrayStoreException org.mongodb formula) (ArrayList.java: 361) org.mongodb.morphia.utils.ReflectionUtils.convertToArray (ReflectionUtils.java Titer38) on .morphia.converters.IntegerConverter.decode (IntegerConverter.java35) org.mongodb.morphia.converters.DefaultConverters.fromDBObject (DefaultConverters .java: 133) on org.mongodb.morphia.mapping.ValueMapper.fromDBObject (ValueMapper.java: 27) org.mongodb.morphia.mapping.Mapper.readMappedField (Mapper.java:601) org.mongodb.morphia.mapping On at .Mapper.fromDb (Mapper.java +82) at org.mongodb.morphia.mapping. Mapper Org.mongodb.morphia.query.MorphiaIterator on From Dobobijet (Mapper. convertItem (MorphiaIterator.java:79) on org.mongodb on org.mongodb.morphia.query.MorphiaIterator.processItem (MorphiaIterator.java:65) org.mongodb.morphia.query.MorphiaIterator.next (MorphiaIterator.java:60) .morphia.query.QueryImpl.asList (QueryImpl.java:305)   

it TypeConverter I BigDecimal use

  public class BigDecimalConverter extends TypeConverter is SimpleValueConverter Applies to {public BigDecimalConverter () {superDigimal.class}; } @OverWide Public Object Encoded (Object Value, MappedField Optional Extranfo) {BigDecal Val = (BigDecamal) value; If (val == empty) tap back; Return val.toPlainString (); } @ Override public object decode (class target class, object from dobojject, mappedfield optional extranfo) {if (dabobject == blank) returns empty; Bigidicum DCC = new BigDec (DBboject.string ()); Return DC; }}   

simplified POJO class

  @Entity (value = "a_table", noClassnameStored = true)   

Public Class Marfariya Object {@Id ObjectId Id; @Property ("Rating") Integer [] ratings; @ Property ("Money") BigDeCal Money; Public Object IDI (ID) {Return ID; } Public morfiare object set id (object id) {id = id; This return; } Public Integer [] getRatings () {Return Ratings; } Public Morpheyri Object Seiterratings (Integer [] Ratings) {this.ratings = Rating; This return; } Public BigDecimal getMoney () {refund; } Public MorphiaArrayObject Set Money {this.money = money; This return; } @ Override public string toastring (return) {return "morphiorry object [id =" + id + ", rating =" + + + + Tosting (rating) + ", money =" + plus + "]; }}

If you add a document using morphia, then finding and writing the work as follows with the following code:

  MorphiaArrayObject obj = new MorphiaArrayObject (); Obj.setMoney (new BigDesque ("1000000.00"); Obj.setRatings (new int [] (4, 7, 8, 9}); Db.save (obj);   

But if you add the object to open the JavaScript, I get an error Join item when added to the shell using Morphy code:

db.a_table. Insert ({Money: "345.0", Rating: [4, 5, 9, 8]}); < / P>

There is a problem with the use of ARMS:

Integer [] evaluation;

I stopped using arrays at morphia and instead use the list And it works around the problem.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -