converting a java object to BLOB
hie
i m using adf 11g latest jdev.
I have a java object of class Animal{
String aniName;
void setAniName(String name){
...
}
void getAniName(){
..}
}
i want to convert this object to a BLOB type. How do i do that?
I tried:
Blob customObject = null;
Object customObjectdata = new Animal ();
if(customObjectdata != null){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream objOstream = new ObjectOutputStream(baos);
objOstream.writeObject(customObjectdata);
objOstream.flush();
objOstream.close();
byte[] bArray = baos.toByteArray();
customObject =BlobDomain.createEmptyBLOB(bArray);
}
but this throw jbo 29000 invalid empty lob operation. googling did not reveal anything useful. Please advise.