@Instrument public static <T extends Model> T findBy(String field,Object value) throws TooManyRecordsException { return (T)query().where(field + "=?",value).singleOrNull(); }
@Instrument public static <T extends Model> T findBy(String field1,Object value1, String field2, Object value2) throws TooManyRecordsException { return (T)query().where(field1 + "=? and " + field2 + "=?",value1, value2).singleOrNull(); }
@Override public AuthzSSOSession loadSessionById(String id) { AuthzSSOSessionEntity session = null; if(null != loadSessionByIdCommand) { session = dao.createQuery(AuthzSSOSessionEntity.class, loadSessionByIdCommand).singleOrNull(); }else{ session = dao.createCriteriaQuery(AuthzSSOSessionEntity.class) .where("id = ? and expiration > ?", new Object[]{id, new Date()}) .singleOrNull(); } if(null == session) { return null; } return createSessionFromEntity(session); }
@Override public AuthzSSOSession loadSessionById(String id) { AuthzSSOSessionEntity session = null; if(null != loadSessionByIdCommand) { session = dao.createQuery(AuthzSSOSessionEntity.class, loadSessionByIdCommand).singleOrNull(); }else{ session = dao.createCriteriaQuery(AuthzSSOSessionEntity.class) .where("id = ? and expiration > ?", new Object[]{id, new Date()}) .singleOrNull(); } if(null == session) { return null; } return createSessionFromEntity(session); }