List of usage examples for javax.persistence NoResultException getCause
public synchronized Throwable getCause()
From source file:com.haulmont.cuba.core.app.RdbmsStore.java
@SuppressWarnings("unchecked") protected <E extends Entity> List<E> executeQuery(Query query, boolean singleResult) { List<E> list;/*ww w . j a v a 2 s . c om*/ try { if (singleResult) { try { E result = (E) query.getSingleResult(); list = new ArrayList<>(1); list.add(result); } catch (NoResultException e) { list = Collections.emptyList(); } } else { list = query.getResultList(); } } catch (javax.persistence.PersistenceException e) { if (e.getCause() instanceof org.eclipse.persistence.exceptions.QueryException && e.getMessage() != null && e.getMessage().contains("Fetch group cannot be set on report query")) { throw new DevelopmentException("DataManager cannot execute query for single attributes"); } else { throw e; } } return list; }