Package org.hibernate.criterion

Examples of org.hibernate.criterion.DetachedCriteria


  }

  @SuppressWarnings("unchecked")
  @Override
  public List<Article> getAllArticles() {
    DetachedCriteria criteria = DetachedCriteria.forClass(Article.class);
    criteria.addOrder(Order.asc("artKurzbezeichnung"));

    return getHibernateTemplate().findByCriteria(criteria);
  }
View Full Code Here


  @SuppressWarnings("unchecked")
  @Override
  public List<Article> getArticlesLikeArticleNumber(String text) {

    DetachedCriteria criteria = DetachedCriteria.forClass(Article.class);
    criteria.add(Restrictions.ilike("artNr", text, MatchMode.ANYWHERE));

    return getHibernateTemplate().findByCriteria(criteria);
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public List<Article> getArticlesLikeName(String string) {

    DetachedCriteria criteria = DetachedCriteria.forClass(Article.class);
    criteria.add(Restrictions.ilike("artKurzbezeichnung", string, MatchMode.ANYWHERE));

    return getHibernateTemplate().findByCriteria(criteria);
  }
View Full Code Here

public class ApplicationNewsDAOImpl extends BasisDAO<ApplicationNews> implements ApplicationNewsDAO {

  @SuppressWarnings("unchecked")
  @Override
  public List<ApplicationNews> getAllApplicationNews() {
    DetachedCriteria criteria = DetachedCriteria.forClass(ApplicationNews.class);
    criteria.addOrder(Order.desc("date"));

    return getHibernateTemplate().findByCriteria(criteria);
  }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  @Override
  public ResultObject getAllApplicationNews(int start, int pageSize) {
    DetachedCriteria criteria = DetachedCriteria.forClass(ApplicationNews.class);
    criteria.addOrder(Order.desc("date"));

    int totalCount = getHibernateTemplate().findByCriteria(criteria).size();

    List<ApplicationNews> list = getHibernateTemplate().findByCriteria(criteria, start, pageSize);
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public SecUserrole getUserroleByUserAndRole(SecUser aUser, SecRole aRole) {

    DetachedCriteria criteria = DetachedCriteria.forClass(SecUserrole.class);
    criteria.add(Restrictions.eq("secRole", aRole));
    criteria.add(Restrictions.eq("secUser", aUser));

    return (SecUserrole) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
  }
View Full Code Here

    return (SecUserrole) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
  }

  @Override
  public boolean isUserInRole(SecUser aUser, SecRole aRole) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecUserrole.class);
    criteria.add(Restrictions.eq("secUser", aUser));
    criteria.add(Restrictions.eq("secRole", aRole));
    criteria.setProjection(Projections.rowCount());

    int count = DataAccessUtils.intResult(getHibernateTemplate().findByCriteria(criteria));
    return count > 0;
  }
View Full Code Here

    return get(SecUser.class, usr_id);
  }

  @SuppressWarnings("unchecked")
  public SecUser getUserByFiluserNr(String usr_nr) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecUser.class);
    criteria.add(Restrictions.eq("usrNr", usr_nr));

    return (SecUser) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
  }
View Full Code Here

    return (SecUser) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
  }

  @SuppressWarnings("unchecked")
  public SecUser getUserByLoginname(final String userName) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecUser.class);
    criteria.add(Restrictions.eq("usrLoginname", userName));
    return (SecUser) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
  }
View Full Code Here

    return (SecUser) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
  }

  @SuppressWarnings("unchecked")
  public SecUser getUserByNameAndPassword(final String userName, final String userPassword) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecUser.class);
    criteria.add(Restrictions.eq("usrLoginname", userName));
    criteria.add(Restrictions.eq("usrPassword", userPassword));

    return (SecUser) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
  }
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.