Example usage for org.hibernate Query list

List of usage examples for org.hibernate Query list

Introduction

In this page you can find the example usage for org.hibernate Query list.

Prototype

List<R> list();

Source Link

Document

Return the query results as a List.

Usage

From source file:bbdd.Usuario_RegistradoDAO.java

public static List queryUsuario_Registrado(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From bbdd.Usuario_Registrado as Usuario_Registrado");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from w ww  . ja  v  a  2 s  .co m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:be.ugent.tiwi.sleroux.newsrec.newsreclib.dao.mysqlImpl.DebuggingMysqlNewsSourceDao.java

License:Apache License

@Override
public NewsSource[] getSourcesToCheck() {
    Query query = session.createQuery("from NewsSource where id=410");
    List<NewsSource> sources = query.list();

    return sources.toArray(new NewsSource[sources.size()]);
}

From source file:be.ugent.tiwi.sleroux.newsrec.newsreclib.dao.mysqlImpl.DebuggingMysqlNewsSourceDao.java

License:Apache License

@Override
public NewsSource[] getAllSources() {
    Query query = session.createQuery("from NewsSource");
    List<NewsSource> sources = query.list();
    return sources.toArray(new NewsSource[sources.size()]);
}

From source file:be.ugent.tiwi.sleroux.newsrec.newsreclib.dao.mysqlImpl.MysqlNewsSourceDao.java

License:Apache License

@Override
public NewsSource[] getSourcesToCheck() throws DaoException {
    try {/*w w w.j  a v  a2s  .  co m*/
        startSession();
        Query query = session.createQuery(
                "from NewsSource where lastFetchTry = null or (lastFetchTry + fetchinterval < CURRENT_TIMESTAMP())");
        List<NewsSource> sources = query.list();
        stopSession();
        return sources.toArray(new NewsSource[sources.size()]);
    } catch (Exception ex) {
        logger.error(ex);
        return new NewsSource[0];
    }
}

From source file:be.ugent.tiwi.sleroux.newsrec.newsreclib.dao.mysqlImpl.MysqlNewsSourceDao.java

License:Apache License

/**
 *
 * @return @throws DaoException/* w  ww. j av  a  2  s  .c  o  m*/
 */
@Override
public NewsSource[] getAllSources() throws DaoException {
    try {
        startSession();
        Query query = session.createQuery("from NewsSource");
        List<NewsSource> sources = query.list();
        stopSession();
        return sources.toArray(new NewsSource[sources.size()]);
    } catch (Exception ex) {
        logger.error(ex);
        return new NewsSource[0];
    }

}

From source file:be.ugent.tiwi.sleroux.newsrec.stormNewsFetch.dao.mysqlImpl.DebuggingMysqlNewsSourceDao.java

License:Apache License

/**
 *
 * @return//w  w w. j  a va2  s  . co  m
 */
@Override
public NewsSource[] getSourcesToCheck() {
    Query query = session.createQuery("from NewsSource where id=410");
    List<NewsSource> sources = query.list();

    return sources.toArray(new NewsSource[sources.size()]);
}

From source file:be.ugent.tiwi.sleroux.newsrec.stormNewsFetch.dao.mysqlImpl.DebuggingMysqlNewsSourceDao.java

License:Apache License

/**
 *
 * @return//from w w  w  . j a  va  2 s.  co m
 */
@Override
public NewsSource[] getAllSources() {
    Query query = session.createQuery("from NewsSource");
    List<NewsSource> sources = query.list();
    return sources.toArray(new NewsSource[sources.size()]);
}

From source file:be.ugent.tiwi.sleroux.newsrec.stormNewsFetch.dao.mysqlImpl.MysqlNewsSourceDao.java

License:Apache License

/**
 *
 * @return//from   www . j av  a2 s . c  o m
 * @throws DaoException
 */
@Override
public NewsSource[] getSourcesToCheck() throws DaoException {
    startSession();
    Query query = session.createQuery(
            "from NewsSource where lastFetchTry = null or (lastFetchTry + fetchinterval < CURRENT_TIMESTAMP())");
    List<NewsSource> sources = query.list();
    stopSession();
    return sources.toArray(new NewsSource[sources.size()]);
}

From source file:be.ugent.tiwi.sleroux.newsrec.stormNewsFetch.dao.mysqlImpl.MysqlNewsSourceDao.java

License:Apache License

/**
 *
 * @return/*  w ww  .j  av  a  2  s .co  m*/
 * @throws DaoException
 */
@Override
public NewsSource[] getAllSources() throws DaoException {
    startSession();
    Query query = session.createQuery("from NewsSource");
    List<NewsSource> sources = query.list();
    stopSession();
    return sources.toArray(new NewsSource[sources.size()]);
}

From source file:bean.gestionRestos.java

public List<SelectItem> listerTypeCuisine() {
    List<SelectItem> items = new ArrayList<SelectItem>();
    List<Typecuisine> listeTypecuisine = null;

    Transaction tx = null;/* w w  w  . java  2 s  .  c o m*/
    this.session = HibernateUtil.getSessionFactory().openSession();
    try {
        tx = session.beginTransaction();
        Query q = session.createQuery("from typecuisine");
        listeTypecuisine = q.list();
    } catch (Exception e) {
        e.printStackTrace();
    }
    items = (List<SelectItem>) (SelectItem) listeTypecuisine;
    return items;
}