Example usage for org.hibernate Criteria setProjection

List of usage examples for org.hibernate Criteria setProjection

Introduction

In this page you can find the example usage for org.hibernate Criteria setProjection.

Prototype

public Criteria setProjection(Projection projection);

Source Link

Document

Used to specify that the query results will be a projection (scalar in nature).

Usage

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public String getDestsNotLogged() {

    log.fine("[ System ] getDestsNotLogged()");

    final Criteria subject = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("dests"));
    subject.setProjection(proList);
    return (String) subject.uniqueResult();
}

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public String getJndiMail() {

    log.fine("[ " + userInfo.getLoggedUsername() + " ] getJndiMail()");

    final Criteria subject = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("jndiMail"));
    subject.setProjection(proList);
    return (String) subject.uniqueResult();
}

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public String getJndiMailNotLogged() {

    log.fine("[ System ] getJndiMail()");

    final Criteria subject = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("jndiMail"));
    subject.setProjection(proList);
    return (String) subject.uniqueResult();
}

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public int getDiffirenceSecs() {

    log.fine("[ " + userInfo.getLoggedUsername() + " ] getDiffirenceSecs()");

    final Criteria difference = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("difference"));
    difference.setProjection(proList);
    final int value = (Integer) difference.uniqueResult();
    return value;
}

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public int getDiffirenceSecsScheduler(String schedulerName) {

    log.fine("[ " + schedulerName + " ] getDiffirenceSecsScheduler()");

    final Criteria difference = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("difference"));
    difference.setProjection(proList);
    final int value = (Integer) difference.uniqueResult();
    return value;
}

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public String getNtpServerAddress() {

    log.fine("[ " + userInfo.getLoggedUsername() + " ] getNtpServerAddress()");

    final Criteria ntpServer = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("ntpServer"));
    ntpServer.setProjection(proList);
    return (String) ntpServer.uniqueResult();
}

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public String getNtpServerAddressNotLogged() {

    log.fine("[ System ] getNtpServerAddress()");

    final Criteria ntpServer = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("ntpServer"));
    ntpServer.setProjection(proList);
    return (String) ntpServer.uniqueResult();
}

From source file:br.com.hrstatus.dao.impl.InstallProcessDAO.java

License:Open Source License

public boolean freshInstall() {

    log.fine("[ System ] invoking freshInstall()");

    final Criteria freshInstall = session().createCriteria(InstallationProcess.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("freshInstall"));
    freshInstall.setProjection(proList);

    boolean result = false;

    try {//w  ww. ja va2s .  c o  m
        final String temp = freshInstall.uniqueResult().toString();

        if (new Boolean(temp)) {
            result = true;
        } else if (!new Boolean(temp)) {
            result = false;
        }
    } catch (java.lang.NullPointerException NPE) {
        result = true;
    }
    return result;
}

From source file:br.com.hrstatus.dao.impl.InstallProcessDAO.java

License:Open Source License

public String getInstallationDate() {

    log.fine("[ System ] invoking getInstallationDate()");
    final Criteria installDate = session().createCriteria(InstallationProcess.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("installDate"));
    installDate.setProjection(proList);
    return installDate.uniqueResult().toString();
}

From source file:br.com.hrstatus.dao.impl.ServersDAO.java

License:Open Source License

@SuppressWarnings("unchecked")
public List<Servidores> getHostnames() {

    log.fine("[ " + userInfo.getLoggedUsername() + " ] getHostnames()");

    try {/*from www  .  j  ava2 s .  c o m*/

        final Criteria criteriaHostname = session().createCriteria(Servidores.class);
        final ProjectionList proList = Projections.projectionList();
        proList.add(Projections.property("id"));
        proList.add(Projections.property("hostname"));
        criteriaHostname.setProjection(proList);
        return criteriaHostname.list();

    } catch (Exception e) {
        log.severe("Error: " + e);
        return new ArrayList<Servidores>();
    }
}