mardi 24 mars 2015

How to store a property that is subclass of class in Mongo DB document using Morphia?

For Example :


I have a class



abstract class A implements Serializable{

//some fields

}

class B extends A {
//fields specific to this class
}

class C extends A {
//fields specific to this class
}

class MyData Serializable {
String someProperty;
B instanceOfB;
C instanceOfC;

// I need to use B,C instead of A
}


When I store MyData using morphia , I get the error : "IllegalArgumentException: Cannot serialize class B"


Aucun commentaire:

Enregistrer un commentaire