Reputation: 2052
I have a java class hierarchy as follows.
public class Results{
private String _query;
private CachedRowSetImpl _resultSet;
//... getter setters
}
I've serialized List<Results> resultList
, consider this List contains 100 items and each _resultSet having more than 1000 records. I have 2 questions,
_resultSet
being deserialized meaning just query is enough?Correct me, if my understanding is wrong.
Upvotes: 3
Views: 239
Reputation: 13455
If you implement Externalizable
,your readExternal
will look somewhat like :
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
_query=(String) in.readObject();
if(//yourCondition){
_resultSet=(CachedRowSetImpl) in.readObject();
}
}
Upvotes: 1
Reputation: 1150
You should implement Serializable. The modifier "transient" can be used to ignore fields during serialization. I do not know what contained in CachedRowSetImpl but when you ignore that then only 100 String objects will not likely cause heap problem.
public class Results implements Serializable{
private String _query;
private transient CachedRowSetImpl _resultSet;
//... getter setters
}
Upvotes: 0