Package vn.pyco.commons.dao.criteria

Examples of vn.pyco.commons.dao.criteria.Criterion


    @SuppressWarnings(value = "unchecked")
    @Override
    public final T get(I id) {
        Criteria criteria = createCriteria();
        Criterion criterion = Restrictions.eq(Identifiable.PROP_ID, id);
        criteria.add(criterion);
        if (_deletable) {
            Criterion notDeleted = Restrictions.eq(Undeletable.PROP_DELETED, new Boolean(false));
            criteria.add(notDeleted);
        }
        return (T) _entityManager.find(_clazz, id);
    }
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    @Override
    public final List<T> get(I... ids) {
        Criterion criterion = Restrictions.in(Identifiable.PROP_ID, ids);
        return findByCriteria(createCriteria().add(criterion));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public final List<T> get(Inheritable<T> parent) {
        if (parent == null) {
            Criterion criterion = Restrictions.isNull(Inheritable.PROP_PARENT);
            return findByCriteria(createCriteria().add(criterion));
        } else {
            Criterion criterion = Restrictions.eq(Inheritable.PROP_PARENT, parent);
            return findByCriteria(createCriteria().add(criterion));
        }
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public final List<T> getAll() {
        Criteria criteria = createCriteria();
        if (_deletable) {
            Criterion notDeleted = Restrictions.eq(Undeletable.PROP_DELETED, new Boolean(false));
            criteria.add(notDeleted);
        }
        return findByCriteria(criteria);
    }
View Full Code Here

    @Override
    public long countAll() {
        Criteria criteria = createCriteria();
        criteria.setProjection(Projections.count(Identifiable.PROP_ID));
        if (isDeletable()) {
            Criterion notDeleted = Restrictions.eq(Undeletable.PROP_DELETED, new Boolean(false));
            criteria.add(notDeleted);
        }
        Long count = (Long) criteria.uniqueResult(_entityManager);
       
        return count;
View Full Code Here

TOP

Related Classes of vn.pyco.commons.dao.criteria.Criterion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.