Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

converting a java object to BLOB

Vik Kumar-OracleOct 7 2010 — edited Nov 9 2011
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 7 2011
Added on Oct 7 2010
11 comments
5,994 views