String queryStr ="from org.olat.core.id.Identity as ident where ident.status = '"
+ Identity.STATUS_ACTIV
+ "' and (ident.lastLogin = null or ident.lastLogin < :lastLogin)";
DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
dbq.setDate("lastLogin", lastLoginLimit.getTime());
List identities = dbq.list();
// 2. get all 'active' identities in deletion process
queryStr = "select ident from org.olat.core.id.Identity as ident"
+ " , org.olat.commons.lifecycle.LifeCycleEntry as le"
+ " where ident.key = le.persistentRef "
+ " and le.persistentTypeName ='" + IdentityImpl.class.getName() + "'"