You can make the Blob transient and then it won't be serialized but it will be null upon deserialization:
private transient Blob data;
I think your only other option is to create a separate object for the blob and only reference it in the RawDataEntity and the use a LoadableDetachableModel to reload it upon request.
public class BlobModel extends LoadableDetachableModel<Blob> {
private int id;
public BlobModel(int id) {
this.id = id;
}
@Override
protected Blob load() {
return dao.getObject(id);
}
}
An other option is change the serialization for pages that cannot be serialized. First create an interface for those pages:
public interface CustomSerialize {
Serializable getSerializable(Object object);
Object getUnserializable(Object object);
}
Next create your own serializer:
public class CustomSerializer extends JavaSerializer {
public CustomSerializer(String applicationKey) {
super(applicationKey);
}
@Override
public byte[] serialize(Object object) {
if (object instanceof CustomSerialize) {
super.serialize(((CustomSerialize) object).getSerializable(object));
}
return super.serialize(object);
}
@Override
public Object deserialize(byte[] data) {
Object object = super.deserialize(data);
if (object instanceof CustomSerialize) {
return ((CustomSerialize) object).getUnserializable(object);
}
return object;
}
}
Then implement that interface on a page which cannot be serialized and write the two methods. getSerializable() should create an object that implements CustomSerializer so that getUnserializable() return the same page.
and last, use the new serializer in your wicket WebApplication:
getFrameworkSettings().setSerializer(new CustomSerializer(getApplicationKey()));