Example usage for org.hibernate Query setBoolean

List of usage examples for org.hibernate Query setBoolean

Introduction

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

Prototype

@Deprecated
@SuppressWarnings("unchecked")
default Query<R> setBoolean(String name, boolean val) 

Source Link

Document

Bind a named boolean-valued parameter.

Usage

From source file:com.ocare.oclinic.dao.impl.ComplainDaoImpl.java

@SuppressWarnings("unchecked")
@Override//from w ww  .j av  a2s  .  c o m
public List<Complain> getSignedComplains() {
    return getHibernateTemplate().execute(new HibernateCallback<List<Complain>>() {
        @Override
        public List<Complain> doInHibernate(Session sn) throws HibernateException {
            Query query = sn.createQuery("from Complain c where c.signed = :signed order by c.name asc");
            query.setBoolean("signed", true);
            return (List<Complain>) query.list();
        }
    });
}

From source file:com.ocare.oclinic.dao.impl.ComplainDaoImpl.java

@SuppressWarnings("unchecked")
@Override//w ww  . j  a v  a 2  s.  co m
public List<Complain> getUnSignedComplains() {
    return getHibernateTemplate().execute(new HibernateCallback<List<Complain>>() {
        @Override
        public List<Complain> doInHibernate(Session sn) throws HibernateException {
            Query query = sn.createQuery("from Complain c where c.signed <> :signed order by c.name asc");
            query.setBoolean("signed", true);
            return (List<Complain>) query.list();
        }
    });
}

From source file:com.ocare.oclinic.dao.impl.DiagnosisDaoImpl.java

@SuppressWarnings("unchecked")
@Override//from   www .jav  a  2  s .  c o  m
public List<Diagnosis> getSignedDiagnisises() {
    return getHibernateTemplate().execute(new HibernateCallback<List<Diagnosis>>() {
        @Override
        public List<Diagnosis> doInHibernate(Session sn) throws HibernateException {
            Query query = sn.createQuery("from Diagnosis d where d.signed = :signed order by d.name asc");
            query.setBoolean("signed", true);
            return (List<Diagnosis>) query.list();
        }
    });
}

From source file:com.ocare.oclinic.dao.impl.DiagnosisDaoImpl.java

@SuppressWarnings("unchecked")
@Override/* w ww  .  ja  v  a  2  s  .c o m*/
public List<Diagnosis> getUnSignedDiagnisises() {
    return getHibernateTemplate().execute(new HibernateCallback<List<Diagnosis>>() {
        @Override
        public List<Diagnosis> doInHibernate(Session sn) throws HibernateException {
            Query query = sn.createQuery("from Diagnosis d where d.signed <> :signed order by d.name asc");
            query.setBoolean("signed", true);
            return (List<Diagnosis>) query.list();
        }
    });
}

From source file:com.ocare.oclinic.dao.impl.MedicationDaoImpl.java

@SuppressWarnings("unchecked")
@Override/*w w  w  .j  a  v a2 s.c om*/
public List<Medication> getSignedMedications() {
    return getHibernateTemplate().execute(new HibernateCallback<List<Medication>>() {
        @Override
        public List<Medication> doInHibernate(Session sn) throws HibernateException {
            Query query = sn.createQuery("from Medication m where m.signed = :signed order by m.name asc");
            query.setBoolean("signed", true);
            return (List<Medication>) query.list();
        }
    });
}

From source file:com.ocare.oclinic.dao.impl.MedicationDaoImpl.java

@SuppressWarnings("unchecked")
@Override//from  ww w  .  ja v a2 s  .c  o m
public List<Medication> getUnSignedMedications() {
    return getHibernateTemplate().execute(new HibernateCallback<List<Medication>>() {
        @Override
        public List<Medication> doInHibernate(Session sn) throws HibernateException {
            Query query = sn.createQuery("from Medication m where m.signed <> :signed order by m.name asc");
            query.setBoolean("signed", true);
            return (List<Medication>) query.list();
        }
    });
}

From source file:com.ocare.oclinic.dao.impl.PrescriptionDaoImpl.java

@SuppressWarnings("unchecked")
@Override/*from w  ww.jav a 2 s . c om*/
public List<Prescription> getSignedPrescriptions() {
    return getHibernateTemplate().execute(new HibernateCallback<List<Prescription>>() {
        @Override
        public List<Prescription> doInHibernate(Session sn) throws HibernateException {
            Query query = sn.createQuery("from Prescription p where p.signed = :signed order by p.name asc");
            query.setBoolean("signed", true);
            return (List<Prescription>) query.list();
        }
    });
}

From source file:com.ocare.oclinic.dao.impl.PrescriptionDaoImpl.java

@SuppressWarnings("unchecked")
@Override/*from ww w. j a  v  a 2  s.c o  m*/
public List<Prescription> getUnSignedPrescriptions() {
    return getHibernateTemplate().execute(new HibernateCallback<List<Prescription>>() {
        @Override
        public List<Prescription> doInHibernate(Session sn) throws HibernateException {
            Query query = sn.createQuery("from Prescription p where p.signed <> :signed order by p.name asc");
            query.setBoolean("signed", true);
            return (List<Prescription>) query.list();
        }
    });
}

From source file:com.ocare.UMS.dao.imp.MyUserDaoImp.java

@SuppressWarnings("unchecked")
@Override//w  w  w .  j  a v  a 2s  .  co  m
public List<MyUser> getAllUsers() {
    return getHibernateTemplate().execute(new HibernateCallback<List<MyUser>>() {
        @Override
        public List<MyUser> doInHibernate(Session sn) throws HibernateException {
            Query query = sn.createQuery(
                    "select u from MyUser u inner join u.roles r where u.deleted =:deleted AND r.name <> :superAdminRole AND r.name <> :adminRole");
            query.setBoolean("deleted", false);
            query.setString("superAdminRole", "SUPER_ADMIN");
            query.setString("adminRole", "ADMIN");
            List<MyUser> users = query.list();
            //return result 
            return users;
        }
    });
}

From source file:com.ocare.UMS.dao.imp.MyUserDaoImp.java

@SuppressWarnings("unchecked")
@Override//from  w w  w .ja  v  a 2  s  . co  m
public List<MyUser> getAllAdmins() {
    return getHibernateTemplate().execute(new HibernateCallback<List<MyUser>>() {
        @Override
        public List<MyUser> doInHibernate(Session sn) throws HibernateException {
            Query query = sn.createQuery(
                    "select u from MyUser u inner join u.roles r where u.deleted =:deleted AND r.name = :roleName");
            query.setBoolean("deleted", false);
            query.setString("roleName", "ADMIN");
            List<MyUser> users = query.list();
            //return result 
            return users;
        }
    });
}