Example usage for javax.persistence TypedQuery setParameter

List of usage examples for javax.persistence TypedQuery setParameter

Introduction

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

Prototype

TypedQuery<X> setParameter(int position, Object value);

Source Link

Document

Bind an argument value to a positional parameter.

Usage

From source file:com.siriusit.spezg.multilib.storage.jpa.JpaLoanRepository.java

@Override
public List<? extends Loan> findLoanByOwner(Person owner) {
    TypedQuery<LoanDomainObject> query = entityManager.createNamedQuery("findLoanByOwner",
            LoanDomainObject.class);
    query.setParameter("owner", owner);
    return query.getResultList();
}

From source file:org.mitre.openid.connect.repository.impl.JpaPairwiseIdentifierRepository.java

@Override
public PairwiseIdentifier getBySectorIdentifier(String sub, String sectorIdentifierUri) {
    TypedQuery<PairwiseIdentifier> query = manager
            .createNamedQuery(PairwiseIdentifier.QUERY_BY_SECTOR_IDENTIFIER, PairwiseIdentifier.class);
    query.setParameter(PairwiseIdentifier.PARAM_SUB, sub);
    query.setParameter(PairwiseIdentifier.PARAM_SECTOR_IDENTIFIER, sectorIdentifierUri);

    return getSingleResult(query.getResultList());
}

From source file:org.openmeetings.app.data.basic.FieldLanguageDaoImpl.java

public List<FieldLanguage> getLanguages() {
    try {//from w  ww  .j a  va  2s . com
        String hql = "select c from FieldLanguage as c " + "WHERE c.deleted <> :deleted ";
        TypedQuery<FieldLanguage> query = em.createQuery(hql, FieldLanguage.class);
        query.setParameter("deleted", "true");
        List<FieldLanguage> ll = query.getResultList();
        return ll;
    } catch (Exception ex2) {
        log.error("[getLanguages]: ", ex2);
    }
    return null;
}

From source file:com.deltastar.task7.core.repository.api.impl.PositionViewRepositoryImpl.java

@Override
public List<PositionView> getPositionViewListByCustomerId(int customerId, byte positionStatus) {
    TypedQuery<PositionView> query = entityManager.createNamedQuery("findPositionViewByCustomerIdAndStatus",
            PositionView.class);
    query.setParameter("p_customerId", customerId);
    query.setParameter("p_status", positionStatus);
    List<PositionView> result = query.getResultList();

    if (positionStatus == CCConstants.POSITION_STATUS_IN_POSSESSION && !Util.isEmptyList(result)) {
        List<PositionView> filteredResult = new ArrayList<>();
        for (PositionView aResult : result) {
            if (aResult.getShares() > 0) {
                filteredResult.add(aResult);
            }/*from  w ww .j a  va 2s .com*/
        }
        result = filteredResult;
    }
    return result;
}

From source file:com.expressui.core.dao.security.query.RelatedUsersQuery.java

@Override
public void setParameters(TypedQuery<Serializable> typedQuery) {
    if (hasValue(role)) {
        typedQuery.setParameter("role", role);
    }/*from www . java 2s .c o m*/
    if (hasValue(doesNotBelongToRole)) {
        typedQuery.setParameter("doesNotBelongToRole", doesNotBelongToRole);
    }
}

From source file:org.mitre.uma.repository.impl.JpaResourceSetRepository.java

@Override
public Collection<ResourceSet> getAllForOwnerAndClient(String owner, String clientId) {
    TypedQuery<ResourceSet> query = em.createNamedQuery(ResourceSet.QUERY_BY_OWNER_AND_CLIENT,
            ResourceSet.class);
    query.setParameter(ResourceSet.PARAM_OWNER, owner);
    query.setParameter(ResourceSet.PARAM_CLIENTID, clientId);
    return query.getResultList();
}

From source file:com.expressui.core.dao.security.query.RoleQuery.java

@Override
public void setParameters(TypedQuery<Serializable> typedQuery) {
    if (hasValue(name)) {
        typedQuery.setParameter("name", "%" + name.toUpperCase() + "%");
    }/*from  www . ja va  2s.co m*/
    if (hasValue(doesNotBelongToUser)) {
        typedQuery.setParameter("doesNotBelongToUser", doesNotBelongToUser);
    }
}

From source file:org.openmeetings.app.data.basic.ErrorManagement.java

public List<ErrorType> getErrorTypes() {
    try {//from   w  w w  .ja  v a  2s.  com
        String hql = "select c from ErrorType as c " + "WHERE c.deleted <> :deleted ";
        TypedQuery<ErrorType> query = em.createQuery(hql, ErrorType.class);
        query.setParameter("deleted", "true");
        List<ErrorType> ll = query.getResultList();
        return ll;
    } catch (Exception ex2) {
        log.error("[getErrorTypes]: ", ex2);
    }
    return null;
}

From source file:com.deltastar.task7.core.repository.api.impl.TransitionRepositoryImpl.java

@Override
public List<Transition> getTransitionListByCustomerId(int customerId) {
    TypedQuery<Transition> query = entityManager.createNamedQuery("findTransitionByCustomerId",
            Transition.class);
    query.setParameter("p_customerId", customerId);

    return query.getResultList();
}

From source file:com.siriusit.spezg.multilib.storage.jpa.JpaLoanRepository.java

@Override
public List<? extends Loan> findLoanUnitsBy(Person loaner) {
    TypedQuery<LoanDomainObject> query = entityManager.createNamedQuery("findLoanUnitsByPerson",
            LoanDomainObject.class);
    query.setParameter("loaner", loaner);
    return query.getResultList();
}