[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] Re: read blob as byte array issue

Hello James,

Sorry for my late answer...

I still need help... I try to use Converter as you suggest but I dont know how to get the Connection object from the Session argument:

public Object convertDataValueToObjectValue(Object data, Session session) {
 // How to get Connection from Session???

 Long oid = (Long) data;

// Get the Large Object Manager to perform operations with
LargeObjectManager lobj = ((org.postgresql.PGConnection)conn).getLargeObjectAPI();


 // Open the large object for reading
 LargeObject obj = lobj.open(oid, LargeObjectManager.READ);

 // Read the data
 byte buf[] = new byte[obj.size()];
 obj.read(buf, 0, obj.size());

 // Close the object
 obj.close();

 return buf;
}

Thanks a lot!
andiqo