private Map<ObjectIdentity, Acl> lookupObjectIdentities(
			final Collection<ObjectIdentity> objectIdentities, List<Sid> sids) {
		Assert.notEmpty(objectIdentities, "Must provide identities to lookup");

		final Map<Serializable, Acl> acls = new HashMap<>(); // contains
																				// Acls
																				// with
																				// StubAclParents

		// Make the "acls" map contain all requested objectIdentities
		// (including markers to each parent in the hierarchy)
		String sql = computeRepeatingSql(lookupObjectIdentitiesWhereClause,
				objectIdentities.size());

		Set<Long> parentsToLookup = jdbcTemplate.query(sql,
				new PreparedStatementSetter() {
					public void setValues(PreparedStatement ps) throws SQLException {
						int i = 0;
						for (ObjectIdentity oid : objectIdentities) {
							// Determine prepared statement values for this iteration
							String type = oid.getType();

							// No need to check for nulls, as guaranteed non-null by
							// ObjectIdentity.getIdentifier() interface contract
							String identifier = oid.getIdentifier().toString();

							// Inject values
							ps.setString((2 * i) + 1, identifier);
							ps.setString((2 * i) + 2, type);
							i++;
						}
					}
				}, new ProcessResultSet(acls, sids));

		// Lookup the parents, now that our JdbcTemplate has released the database
		// connection (SEC-547)
		if (parentsToLookup.size() > 0) {
			lookupPrimaryKeys(acls, parentsToLookup, sids);
		}

		// Finally, convert our "acls" containing StubAclParents into true Acls
		Map<ObjectIdentity, Acl> resultMap = new HashMap<>();

		for (Acl inputAcl : acls.values()) {
			Assert.isInstanceOf(AclImpl.class, inputAcl,
					"Map should have contained an AclImpl");
			Assert.isInstanceOf(Long.class, ((AclImpl) inputAcl).getId(),
					"Acl.getId() must be Long");

			Acl result = convert(acls, (Long) ((AclImpl) inputAcl).getId());
			resultMap.put(result.getObjectIdentity(), result);
		}

		return resultMap;
	}