List of usage examples for org.hibernate SQLQuery setBinary
@Deprecated @SuppressWarnings("unchecked") default Query<R> setBinary(int position, byte[] val)
From source file:com.bitranger.parknshop.common.dao.impl.PersistantMap.java
License:Open Source License
@Override public void put(final String key, Object value) { Assert.isTrue(value instanceof Serializable, "value must be Serializable"); final byte[] b = ObjUtils.toBytes(value); getHibernateTemplate().execute(new HibernateCallback<Void>() { @Override/*from w w w. jav a 2 s .co m*/ public Void doInHibernate(Session arg0) throws HibernateException, SQLException { SQLQuery query = arg0.createSQLQuery("insert into ps_key_value(key, val)values(?,?)"); query.setString(0, key); query.setBinary(1, b); query.executeUpdate(); return null; } }); }
From source file:uk.ac.kcl.iop.brc.core.pipeline.dncpipeline.data.FullPipelineIntegrationTests.java
License:Open Source License
private void insertBinaries(Session session) { String sql = "INSERT INTO tblTestDocs (patient_id, doc_id, doc) VALUES(?,?,?)"; int i = 1;/*from ww w . java 2s .c o m*/ for (byte[] object : ba) { SQLQuery query = session.createSQLQuery(sql); query.setInteger(0, 1); query.setInteger(1, i); query.setBinary(2, object); query.executeUpdate(); i++; } }