query.select(from);
Predicate predicate1 = criteriaBuilder.equal(from.get("oid"), oid);
Predicate predicate2 = criteriaBuilder.le(from.get("timestamp"), timestamp);
query.where(criteriaBuilder.and(predicate1, predicate2));
query.orderBy(criteriaBuilder.desc(from.get("timestamp")));
TypedQuery<JPAObject> typedQuery = entityManager.createQuery(query).setMaxResults(1);
List<JPAObject> resultList = typedQuery.getResultList();
if (resultList.size() < 1) {