
org.ow2.bonita.pvm.internal.lob.BlobStrategyBlob Maven / Gradle / Ivy
package org.ow2.bonita.pvm.internal.lob;
import java.sql.SQLException;
import org.hibernate.Hibernate;
import org.ow2.bonita.pvm.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;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy