@Override
    public PublishedItem getPublishedItem(LeafNode node, PublishedItem.UniqueIdentifier itemIdentifier)
    {
        // fetch item from DB
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(LOAD_ITEM);
            pstmt.setString(1, node.getUniqueIdentifier().getServiceIdentifier().getServiceId());
            pstmt.setString(2, node.getNodeID());
            pstmt.setString(3, itemIdentifier.getItemId());
            rs = pstmt.executeQuery();

            // Add to each node the corresponding subscriptions
            if (rs.next()) {
                JID publisher = new JID(rs.getString(1));
                Date creationDate = new Date(Long.parseLong(rs.getString(2).trim()));
                // Create the item
                final PublishedItem result = new PublishedItem(node, publisher, itemIdentifier.getItemId(), creationDate);
                // Add the extra fields to the published item
                if (rs.getString(3) != null) {
                    result.setPayloadXML(rs.getString(3));
                }
                return result;
            }
        } catch (Exception exc) {
            log.error("An exception occurred while trying to obtain item {} from node {}", itemIdentifier.getItemId(), node.getUniqueIdentifier(), exc);
        } finally {
            DbConnectionManager.closeConnection(pstmt, con);
        }
        return null;
	}
Writes large changesets to the database, using batches and transactions when
available.

The 'delete' list takes precedence over the 'add' list: when an item exists
on both lists, it is removed (and not re-added) to the database.

To prevent duplicates to exist in the database, this method will attempt to
remove all items to-be-added from the database, before re-adding them.

Note that multiple attempts to write items to the DB are made:
1) insert all pending items in a single batch
2) if the batch insert fails, retry by inserting each item separately

@param addList A list of items to be added to the database.
@param delList A list of items to be removed from the database.
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/DefaultPubSubPersistenceProvider.java