Example usage for org.hibernate.engine.jdbc SerializableBlobProxy getWrappedBlob

List of usage examples for org.hibernate.engine.jdbc SerializableBlobProxy getWrappedBlob

Introduction

In this page you can find the example usage for org.hibernate.engine.jdbc SerializableBlobProxy getWrappedBlob.

Prototype

public Blob getWrappedBlob() 

Source Link

Document

Access to the wrapped Blob reference

Usage

From source file:cognition.pipeline.data.helper.BlobHelper.java

License:Apache License

private byte[] getBytesFromSerializableBlob(Object serializableBlobProxy) {
    SerializableBlobProxy blobProxy = (SerializableBlobProxy) Proxy.getInvocationHandler(serializableBlobProxy);
    Blob wrappedBlob = blobProxy.getWrappedBlob();
    try {//from   w  w w . j  a  v  a2 s  . c o m
        byte[] bytes = wrappedBlob.getBytes(1, (int) wrappedBlob.length());
        if (bytes != null) {
            if (bytes.length == 0) {
                return null;
            }
        }
        return bytes;
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return null;
}