Ejemplo n.º 1
0
 @Override
 public void nullSafeSet(
     PreparedStatement preparedStatement,
     Object value,
     int index,
     SessionImplementor sessionImplementor)
     throws HibernateException, SQLException {
   if (value != null) {
     Attachment attachment = (Attachment) value;
     preparedStatement.setString(index, attachment.getContentType());
     preparedStatement.setString(index + 1, attachment.getName());
     preparedStatement.setBytes(index + 2, attachment.getContent());
   } else {
     preparedStatement.setObject(index, null);
     preparedStatement.setObject(index + 1, null);
     preparedStatement.setObject(index + 2, null);
   }
 }