Page 1 of 1

serialize java object DataRow

Posted: 28 May 2011, 14:53
by Jipii
Hello,

I try to serialize my game room object with all cards, scores and so on, to rebuild situation in which bugs occurs.
I get a NotSerializableException, because some attributes have the type DataRow.
How can I serialize them?

Is it a good solution to write a new class like this:

Code: Select all

package poker;

import java.io.Serializable;

import it.gotoandplay.smartfoxserver.db.DataRow;

public class DataRowSerializer extends DataRow  implements Serializable
{

}
But then I will get a ClassCastException if I try to assign query results to a new object DataRowSerializer .
:?

Posted: 30 May 2011, 07:17
by BigFIsh
Looks like DataRow isn't serializable, thus the class cast exception.

You may have to convert all variables of type DataRow into something else before serializing your game room. Possibly as type Map? There is a method to fetch the data as map --> DataRow.getDataAsMap()