Skip to content

Commit

Permalink
name resolution helper fix
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Dec 17, 2017
1 parent c994e84 commit 62e140b
Showing 1 changed file with 5 additions and 6 deletions.
Expand Up @@ -23,7 +23,7 @@
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
import org.apache.commons.collections4.CollectionUtils;
import org.hibernate.Query;
import org.hibernate.query.Query;
import org.hibernate.Session;
import org.hibernate.transform.Transformers;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -82,13 +82,12 @@ public void resolveNamesIfRequested(Session session, List<? extends PrismContain
if (batch.size() >= MAX_OIDS_TO_RESOLVE_AT_ONCE || !iterator.hasNext()) {
Query query = session.getNamedQuery("resolveReferences");
query.setParameterList("oid", batch);
query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);

@SuppressWarnings({ "unchecked", "raw" })
List<Map<String, Object>> results = query.list(); // returns oid + name
for (Map<String, Object> result : results) {
String oid = (String) result.get("0");
RPolyString name = (RPolyString) result.get("1");
List<Object[]> results = query.list(); // returns oid + name
for (Object[] result : results) {
String oid = (String) result[0];
RPolyString name = (RPolyString) result[1];
oidNameMap.put(oid, new PolyString(name.getOrig(), name.getNorm()));
}
batch.clear();
Expand Down

0 comments on commit 62e140b

Please sign in to comment.