Package org.hibernate.criterion

Examples of org.hibernate.criterion.DetachedCriteria


    public List<User> getAllUsers() {
        return getAllUsers(1000);
    }

    public List<User> getAllUsers(int max) {
        DetachedCriteria crit = DetachedCriteria.forClass(User.class);

        List<User> posts = getHibernateTemplate().findByCriteria(crit, 0,
                max);
        return posts;
    }
View Full Code Here


    public Loadable get(Class<? extends Loadable> loadable, Long id) {
        return (Loadable) getHibernateTemplate().get(loadable, id);
    }

    public List<School> getAllSchools(int start, int max) {
        DetachedCriteria crit = DetachedCriteria.forClass(School.class)
                .addOrder(Order.desc("popularityCounter"));

        // .add(
        // Expression.and(Expression.gt("id", 890l),
        // Expression.eq("latitude", -1d)));
View Full Code Here

                start, max);
        return list;
    }

    public List<ProcessType> getDefaultProcessTypes() {
        DetachedCriteria crit = DetachedCriteria.forClass(
                ProcessType.class).add(
                Expression.eq("useByDefault", true)).addOrder(
                Order.asc("id"));

        return getHibernateTemplate().findByCriteria(crit);
View Full Code Here

        return getHibernateTemplate().findByCriteria(crit);
    }

    public List<RatingType> getDefaultRatingTypes() {
        DetachedCriteria crit = DetachedCriteria.forClass(
                RatingType.class)
                .add(Expression.eq("useByDefault", true)).addOrder(
                        Order.asc("id"));

        return getHibernateTemplate().findByCriteria(crit);
View Full Code Here

        return getHibernateTemplate().findByCriteria(crit);
    }

    public ProcessType getProcessForName(String string) {
        DetachedCriteria crit = DetachedCriteria.forClass(
                ProcessType.class).add(Expression.eq("name", string));

        return (ProcessType) DataAccessUtils
                .uniqueResult(getHibernateTemplate().findByCriteria(crit));
    }
View Full Code Here

    }

    public List<School> getSchoolsMatching(String match, int start,
            int max, MatchMode matchMode) {

        DetachedCriteria crit = DetachedCriteria.forClass(School.class)
                .add(Expression.ilike("name", match, matchMode))
                .addOrder(Order.asc("name"));

        List<School> list = getHibernateTemplate().findByCriteria(crit,
                start, max);
View Full Code Here

        return list;
    }

    public List<ProcessType> matchProcessType(String queryString) {
        DetachedCriteria crit = DetachedCriteria.forClass(
                ProcessType.class)
                .add(
                        Expression.ilike("name", queryString,
                                MatchMode.ANYWHERE)).addOrder(
                        Order.asc("name"));
View Full Code Here

    public PostsList getThreads(Class<? extends ForumPost> forumClass,
            String topicName, long topicID, int start, int max) {

        System.out.println("start " + start + " max " + max);

        DetachedCriteria crit = DetachedCriteria.forClass(forumClass,
                "fp").add(
                Expression.and(Expression.eq(topicName, topicID),
                        Expression.isNull("threadPost"))).addOrder(
                Order.desc("date"));
View Full Code Here

    private List finder(String hql, Object... args) {
        return getHibernateTemplate().find(hql, args);
    }

    public PostsList getPostsForThread(ForumPost post, int start, int max) {
        DetachedCriteria crit = DetachedCriteria
                .forClass(ForumPost.class).add(
                        Expression.or(Expression.eq("threadPost.id", post
                                .getId()), Expression.eq("id", post
                                .getId()))).addOrder(Order.asc("date"));
View Full Code Here

        return getThreads(UserForumPost.class, "user.id", userID, start,
                max);
    }

    public PostsList getRecentForumPosts(int start, int max) {
        DetachedCriteria crit = DetachedCriteria.forClass(
                ForumPost.class, "fp").add(
                Expression.isNull("threadPost")).addOrder(
                Order.desc("date"));

        List<ForumPost> posts = getHibernateTemplate().findByCriteria(
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.DetachedCriteria

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.