On Android, cannot save an object with a BigDecimal field

502 views
Skip to first unread message

eli...@innovorder.fr

unread,
Nov 24, 2016, 5:57:13 PM11/24/16
to Firebase Google Group
Hi,

On android I try to save an object to the firebase real-time database, it used to work on version 2.5.2 but on firebase version 9.8.0 I have the following exception when I try to save : 

com.google.firebase.database.DatabaseException: Failed to parse node with class class java.math.BigDecimal
                                                                                                        at com.google.android.gms.internal.zzamm.zza(Unknown Source)
                                                                                                        at com.google.android.gms.internal.zzamm.zzbt(Unknown Source)
                                                                                                        at com.google.android.gms.internal.zzamm.zza(Unknown Source)
                                                                                                        at com.google.firebase.database.DatabaseReference.zza(Unknown Source)
                                                                                                        at com.google.firebase.database.DatabaseReference.setValue(Unknown Source)

Any suggestion on how to handle this on the new version of firebase ?

Best regards.

Kato Richardson

unread,
Nov 28, 2016, 2:42:07 PM11/28/16
to Firebase Google Group
Hello (Elid?),

Can you please share some code and sample data demonstrating the issue? Are you, perhaps, ignoring the offending field in your old 2.x code by using Jackson annotations?

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/2e40463a-8285-439d-8eaa-77a3c78111ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

eli...@innovorder.fr

unread,
Nov 29, 2016, 10:20:06 AM11/29/16
to Firebase Google Group
Hi Kato, 

Here an example :

A simple java object :

public class Pojo {

private BigDecimal value;

public Pojo(BigDecimal value) {
this.value = value;
}

public BigDecimal getValue() {
return value;
}

public void setValue(BigDecimal value) {
this.value = value;
}
}

Then I try to push this object on the firebase database with

Pojo pojo = new Pojo(new BigDecimal(5));
String key = databaseReference.push().getKey();
databaseReference.child(key).setValue(pojo);

Then I get the following exception 

com.google.firebase.database.DatabaseException: Failed to parse node with class class java.math.BigDecimal
at com.google.android.gms.internal.zzamm.zza(Unknown Source)
at com.google.android.gms.internal.zzamm.zzbt(Unknown Source)
at com.google.android.gms.internal.zzamm.zza(Unknown Source)

Tell me if you need something else.

Thank you

Elid.


Le lundi 28 novembre 2016 20:42:07 UTC+1, Kato Richardson a écrit :
Hello (Elid?),

Can you please share some code and sample data demonstrating the issue? Are you, perhaps, ignoring the offending field in your old 2.x code by using Jackson annotations?

☼, Kato
On Thu, Nov 24, 2016 at 7:13 AM, <eli...@innovorder.fr> wrote:
Hi,

On android I try to save an object to the firebase real-time database, it used to work on version 2.5.2 but on firebase version 9.8.0 I have the following exception when I try to save : 

com.google.firebase.database.DatabaseException: Failed to parse node with class class java.math.BigDecimal
                                                                                                        at com.google.android.gms.internal.zzamm.zza(Unknown Source)
                                                                                                        at com.google.android.gms.internal.zzamm.zzbt(Unknown Source)
                                                                                                        at com.google.android.gms.internal.zzamm.zza(Unknown Source)
                                                                                                        at com.google.firebase.database.DatabaseReference.zza(Unknown Source)
                                                                                                        at com.google.firebase.database.DatabaseReference.setValue(Unknown Source)

Any suggestion on how to handle this on the new version of firebase ?

Best regards.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/2e40463a-8285-439d-8eaa-77a3c78111ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Valter Negreiros

unread,
Jul 26, 2017, 3:46:50 PM7/26/17
to Firebase Google Group
Make a converter in Java between String and BigDecimal,

Store the String value in Firebase Database, restore as String but parse to BigDecimal Constructor in your class java.
Reply all
Reply to author
Forward
0 new messages