Example usage for org.hibernate.criterion Restrictions allEq

List of usage examples for org.hibernate.criterion Restrictions allEq

Introduction

In this page you can find the example usage for org.hibernate.criterion Restrictions allEq.

Prototype

@SuppressWarnings("UnusedDeclaration")
public static Criterion allEq(Map<String, ?> propertyNameValues) 

Source Link

Document

Apply an "equals" constraint to each property in the key set of a Map

Usage

From source file:com.vmware.bdd.entity.CloudProviderConfigEntity.java

License:Open Source License

public static CloudProviderConfigEntity findUniqueByAttributeValue(String type, String attributeName,
        String attributeValue) {//  w  w w  .  j  a  va  2s .  c o m
    Map<String, String> propertyNameValues = new HashMap<String, String>();
    propertyNameValues.put("cloudType", type);
    propertyNameValues.put("attribute", attributeName);
    propertyNameValues.put("value", attributeValue);
    return DAL.findUniqueByCriteria(CloudProviderConfigEntity.class, Restrictions.allEq(propertyNameValues));
}

From source file:com.vmware.bdd.entity.VcDataStoreEntity.java

License:Open Source License

public static List<VcDataStoreEntity> findByNameAndType(DatastoreType type, String name) {
    Map<String, Object> propertyNameValues = new HashMap<String, Object>();
    propertyNameValues.put("name", name);
    propertyNameValues.put("type", type);
    return DAL.findByCriteria(VcDataStoreEntity.class, Restrictions.allEq(propertyNameValues));
}

From source file:com.vmware.bdd.entity.VcDataStoreEntity.java

License:Open Source License

public static VcDataStoreEntity findByNameAndDatastore(String name, String datastoreName) {
    Map<String, String> propertyNameValues = new HashMap<String, String>();
    propertyNameValues.put("name", name);
    propertyNameValues.put("vcDatastore", datastoreName);

    return DAL.findUniqueByCriteria(VcDataStoreEntity.class, Restrictions.allEq(propertyNameValues));
}

From source file:com.vmware.bdd.entity.VcResourcePoolEntity.java

License:Open Source License

public static VcResourcePoolEntity findByClusterAndRp(String vcCluster, String vcRp) {
    Map<String, String> propertyNameValues = new HashMap<String, String>();
    propertyNameValues.put("vcCluster", vcCluster);
    propertyNameValues.put("vcResourcePool", vcRp);

    VcResourcePoolEntity entity = DAL.findUniqueByCriteria(VcResourcePoolEntity.class,
            Restrictions.allEq(propertyNameValues));
    return entity;
}

From source file:org.codehaus.groovy.grails.orm.hibernate.query.AbstractHibernateQuery.java

License:Apache License

@Override
public Query allEq(Map<String, Object> values) {
    addToCriteria(Restrictions.allEq(values));
    return this;
}

From source file:org.jasig.ssp.dao.security.oauth.OAuth1NonceDao.java

License:Apache License

public OAuth1Nonce get(String consumerKey, long timestamp, String nonce) {
    if (StringUtils.isBlank(nonce) || StringUtils.isBlank(consumerKey)) {
        throw new IllegalArgumentException("nonce or consumer key can not be empty.");
    }// w  w w.  j  ava 2  s .  c om

    final Criteria query = sessionFactory.getCurrentSession().createCriteria(OAuth1Nonce.class);
    final LinkedHashMap<String, Object> predicates = Maps.newLinkedHashMap();
    predicates.put("consumerKey", consumerKey);
    predicates.put("nonceTimestamp", timestamp);
    predicates.put("nonce", nonce);
    query.add(Restrictions.allEq(predicates));

    return (OAuth1Nonce) query.uniqueResult();
}

From source file:pl.edu.agh.szia.pa.dao.CommonDAO.java

public Address findAddress(String town, String street, String house) {
    Session s = factory.openSession();// www .j  a  v  a 2s  . co m
    Transaction t = s.getTransaction();
    t.begin();
    Map<String, String> crit = new HashMap<String, String>();
    crit.put("street", street);
    crit.put("house", house);

    List<Address> l = s.createCriteria(Address.class, "a").add(Restrictions.allEq(crit))
            .createAlias("a.town", "t").add(Restrictions.eq("t.name", town)).list();
    t.commit();
    s.close();

    if (l.size() > 0) {
        return l.get(0);
    } else
        return null;
}

From source file:pl.umk.mat.zawodyweb.database.hibernate.AbstractHibernateDAO.java

License:Open Source License

/**
 * Find by criteria.//from  www  .j  ava2s  .co  m
 */
@SuppressWarnings("unchecked")
public List<T> findByCriteria(Map criterias) {

    Criteria criteria = getSession().createCriteria(getPersistentClass());
    criteria.add(Restrictions.allEq(criterias));
    return criteria.list();
}