org.hibernate.Hibernate.createBlob()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(330)

本文整理了Java中org.hibernate.Hibernate.createBlob()方法的一些代码示例,展示了Hibernate.createBlob()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hibernate.createBlob()方法的具体详情如下:
包路径:org.hibernate.Hibernate
类名称:Hibernate
方法名:createBlob

Hibernate.createBlob介绍

[英]Create a new Blob. The returned object will be initially immutable.
[中]创建一个新的Blob。返回的对象最初是不可变的。

代码示例

代码示例来源:origin: snakerflow/snakerflow

public Blob createBlob(byte[] bytes) {
    return Hibernate.createBlob(bytes);
  }
}

代码示例来源:origin: com.github.snakerflow/snaker-hibernate

public Blob createBlob(byte[] bytes) {
    return Hibernate.createBlob(bytes);
  }
}

代码示例来源:origin: org.ow2.bonita/bonita-server

public Blob createBlob(byte[] bytes) {
 return Hibernate.createBlob(bytes);
}

代码示例来源:origin: org.jbpm/pvm

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

代码示例来源:origin: org.ow2.bonita/bonita-pvm

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

代码示例来源:origin: org.nakedobjects/nos-objectstore-hibernate

public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    st.setNull(index, Types.BLOB);
  } else {
    st.setBlob(index, Hibernate.createBlob(getImageAdapter(value).getAsByteArray()));
  }
}

代码示例来源:origin: org.geoserver.community/gs-monitor-hibernate

public void nullSafeSet(PreparedStatement st, Object value, int index)
    throws HibernateException, SQLException {
  if (value != null) {
    try {
      ByteArrayOutputStream bytes = new ByteArrayOutputStream();
      ObjectOutputStream out = new ObjectOutputStream(bytes);
      out.writeObject(value);
      out.flush();
      if (useHibernateBlob()) {
        st.setBlob(index, Hibernate.createBlob(bytes.toByteArray()));
      } else {
        st.setBytes(index, bytes.toByteArray());
      }
      out.close();
    } catch (IOException e) {
      throw new HibernateException(e);
    }
  } else {
    st.setNull(index, Types.BLOB);
    // st.setBytes(index, null);
  }
}

代码示例来源:origin: com.herbocailleau.sgq/sgq-business

Blob blob = Hibernate.createBlob(is);
is.close();

相关文章