I am encountering a persistent Hibernate error when attempting to search for specific accounts using
Error Message :Cannot invoke “org.hibernate.hql.internal.ast.tree.FromElement.setAllPropertyFetch(boolean)” because “fromElement” is null
Below is the code where I am getting error
import sailpoint.object.Link;
import sailpoint.object.Filter;
import sailpoint.object.QueryOptions;
import java.util.Iterator;
QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.eq(“application.name”, “AD”));
qo.addFilter(Filter.eq(“attributes.SAMACCOUNTNAME”, “1a2a3c”)); // Tried using links.attributes
qo.addFilter(Filter.eq(“attributes.Disabled”, false));
Iterator it = context.search(Link.class, qo);
while (it.hasNext()) {
Link link = (Link) it.next();
Identity id = link.getIdentity();
if (id == null || Boolean.TRUE.equals(id.isDisabled())) {
continue;
}
String displayName = (String) link.getAttribute(“displayName”);
String apmNumber = (String) link.getAttribute(“apmNumber”);
}
I am querying Link.class and filtering on application name and link attributes.
Is this the correct way to construct the filters, or do I need to change anything to avoid this Hibernate error?
I don’t believe we can filter the link attributes directly from QueryOptions.
Probably thats why you are receiving this error.
Please try something like this:
QueryOptions qo = new QueryOptions();
List andFilter= new ArrayList();
andFilter.add(Filter.eq("application.name", "ADName"));
andFilter.add(Filter.like("nativeIdentity", "CN=..., Filter.MatchMode.START));
qo.addFilter(Filter.and(andFilter));
Iterator it = context.search(Link.class, qo);
Than, during the code you can check if the link.isDisable().