Example usage for javax.persistence TypedQuery getParameters

List of usage examples for javax.persistence TypedQuery getParameters

Introduction

In this page you can find the example usage for javax.persistence TypedQuery getParameters.

Prototype

Set<Parameter<?>> getParameters();

Source Link

Document

Get the parameter objects corresponding to the declared parameters of the query.

Usage

From source file:net.awired.generic.jpa.dao.impl.GenericDaoImpl.java

@Transactional(propagation = Propagation.SUPPORTS)
protected <E> E findGenericSingleResult(TypedQuery<E> query) throws NotFoundException {
    try {/*w  w  w  .  j a v a2 s .  c  o  m*/
        return query.getSingleResult();
    } catch (NoResultException e) {
        throw new NotFoundException("Result of " + query + " with parameters '"
                + Arrays.toString(query.getParameters().toArray()) + "' not found in database", e);
    }
}

From source file:net.awired.generic.jpa.dao.impl.GenericDaoImpl.java

@Transactional(propagation = Propagation.SUPPORTS)
protected ENTITY findSingleResult(TypedQuery<ENTITY> query) throws NotFoundException {
    try {//from  w  w  w. j a  v a2  s  . c o m
        return query.getSingleResult();
    } catch (NoResultException e) {
        throw new NotFoundException("Object '" + entityClass + "' with parameters '"
                + Arrays.toString(query.getParameters().toArray()) + "' not found in database", e);
    }
}