code: public synchronized void store(NodeReferences refs) throws ItemStateException {
          if (!initialized) {
              throw new IllegalStateException("not initialized");
          }
  
          // check if insert or update
          boolean update = existsReferencesTo(refs.getTargetId());
          String sql = (update) ? nodeReferenceUpdateSQL : nodeReferenceInsertSQL;
  
          try {
              ByteArrayOutputStream out =
                      new ByteArrayOutputStream(INITIAL_BUFFER_SIZE);
              // serialize references
              Serializer.serialize(refs, out);
  
              Object[] params = createParams(refs.getTargetId(), out.toByteArray(), true);
              conHelper.exec(sql, params);
              
              // there's no need to close a ByteArrayOutputStream
              //out.close();
          } catch (Exception e) {
              String msg = "failed to write " + refs;
              log.error(msg, e);
              throw new ItemStateException(msg, e);
          }
      }
docs: {@inheritDoc}
  
  This method uses shared <code>PreparedStatements</code>, which must
  be used strictly sequentially. Because this method synchronizes on the
  persistence manager instance, there is no need to synchronize on the
  shared statement. If the method would not be synchronized, the shared
  statement must be synchronized.