Package org.jbpm.lob

Source Code of org.jbpm.lob.BlobStrategyBlob

package org.jbpm.lob;

import java.sql.SQLException;

import org.hibernate.Hibernate;
import org.jbpm.PvmException;

public class BlobStrategyBlob implements BlobStrategy {
 
  public void set(byte[] bytes, Blob blob) {
    if (bytes!=null) {
      blob.setBlob(Hibernate.createBlob(bytes));
    }
  }

  public byte[] get(Blob blob) {
    java.sql.Blob sqlBlob = blob.getBlob();
    if (sqlBlob!=null) {
      try {
        return sqlBlob.getBytes(1, (int) sqlBlob.length());
      } catch (SQLException e) {
        throw new PvmException("couldn't extract bytes out of blob", e);
      }
    }
    return null;
  }
}
TOP

Related Classes of org.jbpm.lob.BlobStrategyBlob

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.