Example usage for org.hibernate.criterion Restrictions ne

List of usage examples for org.hibernate.criterion Restrictions ne

Introduction

In this page you can find the example usage for org.hibernate.criterion Restrictions ne.

Prototype

public static SimpleExpression ne(String propertyName, Object value) 

Source Link

Document

Apply a "not equal" constraint to the named property

Usage

From source file:helper.SiparisHelper.java

public List<Siparis> listPersonelRapor(Personel personel, Date startDate, Date endDate) throws Exception {

    List<Siparis> list = new ArrayList<>();
    Session session = null;/*  w  w  w  .  jav a 2  s.c  o  m*/

    System.out.println("Helper: " + personel.getPersonelId());
    try {
        session = sessionFactory.openSession();
        list = session.createCriteria(Siparis.class, "siparis").createAlias("siparis.personel", "personel")
                .createAlias("personel.yetki", "yetki").createAlias("siparis.masa", "masa")
                .createAlias("siparis.stok", "stok").createAlias("stok.urun", "urun")
                .add(Restrictions.eq("personel.personelId", personel.getPersonelId()))
                .add(Restrictions.between("siparis.satisTarihi", startDate, endDate))
                .add(Restrictions.ne("siparis.isAktif", false)).add(Restrictions.ne("personel.isAktif", false))
                .add(Restrictions.ne("masa.isAktif", false)).add(Restrictions.eq("siparis.isOdendi", true))
                .add(Restrictions.eq("masa.isOdendi", true)).add(Restrictions.ne("siparis.isIptal", true))
                .addOrder(Order.desc("siparis.satisTarihi")).list();

    } catch (Exception e) {

        throw e;
    } finally {
        session.close();
    }

    return list;
}

From source file:helper.StokHelper.java

public List<Stok> findStok(Urun urun) throws Exception {

    Session session = null;//w w  w  .ja va 2  s  .c  o m
    List<Stok> list = new ArrayList<>();

    try {
        session = sessionFactory.openSession();
        list = session.createCriteria(Stok.class, "stok").createAlias("stok.urun", "urun")
                .add(Restrictions.eq("urun.urunId", urun.getUrunId()))
                .add(Restrictions.ne("urun.isAktif", false)).add(Restrictions.ne("stok.isAktif", false)).list();
    } catch (Exception e) {
        throw e;
    } finally {
        session.close();
    }

    return list;
}

From source file:helper.StokHelper.java

public List<Stok> getAllStok() throws Exception {

    Session session = null;/*w  w w  . j  av  a 2  s.co m*/
    List<Stok> list = new ArrayList<>();
    try {

        session = sessionFactory.openSession();
        list = session.createCriteria(Stok.class, "stok").createAlias("stok.urun", "urun")
                .add(Restrictions.ne("urun.isAktif", false)).add(Restrictions.ne("stok.isAktif", false)).list();

    } catch (Exception e) {
        throw e;
    } finally {
        session.close();
    }
    return list;
}

From source file:helper.UrunHelper.java

public List<Stok> listUrun() throws Exception {

    Session session = null;//from   www . j  av a 2  s.  com
    List<Stok> list = new ArrayList<>();

    try {
        session = sessionFactory.openSession();
        list = session.createCriteria(Stok.class, "stok").createAlias("stok.urun", "urun")
                .createAlias("urun.urunTur", "urunTur").add(Restrictions.ne("urun.isAktif", false))
                .add(Restrictions.ne("stok.isAktif", false)).list();

    } catch (Exception e) {
        throw e;
    } finally {
        session.close();
    }
    return list;
}

From source file:helper.UrunHelper.java

public Urun findUrun(Urun urun) throws Exception {

    Session session = null;/*from   w w  w.  j a  v a 2 s .c om*/
    Urun getUrun = new Urun();
    try {

        session = sessionFactory.openSession();
        getUrun = (Urun) session.createCriteria(Urun.class, "urun")
                .add(Restrictions.eq("urun.urunId", urun.getUrunId()))
                .add(Restrictions.ne("urun.isAktif", false)).uniqueResult();

    } catch (Exception e) {
        throw e;
    } finally {
        session.close();
    }
    return getUrun;
}

From source file:helper.UrunHelper.java

public Urun findUrun(int urunId) throws Exception {

    Session session = null;/*from  w w  w  .j  av  a2 s.c  o  m*/
    Urun getUrun = new Urun();
    try {

        session = sessionFactory.openSession();
        getUrun = (Urun) session.createCriteria(Urun.class, "urun").add(Restrictions.eq("urun.urunId", urunId))
                .add(Restrictions.ne("urun.isAktif", false)).uniqueResult();

    } catch (Exception e) {
        throw e;
    } finally {
        session.close();
    }
    return getUrun;
}

From source file:helper.UrunTuruHelper.java

public List<UrunTur> listele() throws Exception {

    Session session = null;//from w w w. java 2s .  c  o  m
    List<UrunTur> list = new ArrayList<>();
    try {
        session = sessionFactory.openSession();
        list = session.createCriteria(UrunTur.class, "urunTur").add(Restrictions.ne("urunTur.isAktif", false))
                .list();

    } catch (Exception e) {
        throw e;
    } finally {
        session.close();
    }

    return list;
}

From source file:helper.YetkiHelper.java

public List<Yetki> list() {

    Session session = null;/*from   w ww  .  ja  v a  2 s  .  c o m*/
    List<Yetki> list = new ArrayList<>();
    try {
        session = sessionFactory.openSession();

        list = session.createCriteria(Yetki.class, "yetki").add(Restrictions.ne("yetki.isAktif", false)).list();

    } catch (Exception e) {

        throw e;
    } finally {

        session.close();
    }
    return list;
}

From source file:helpers.OlymHelper.java

public static List<Spordisc> getAllDisciplines() {//nigde se ne koristi?
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction tr = null;/*from w  w  w.jav a  2s.  c  om*/
    List<Spordisc> disc = null;
    try {
        tr = session.beginTransaction();
        Criteria criteria = session.createCriteria(Spordisc.class)
                .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
        criteria.add(Restrictions.ne("disciplina", "/"));
        criteria.addOrder(Order.asc("disciplina"));
        disc = criteria.list();
        // Query q = session.createSQLQuery("select DISTINCT disciplina from spordisc where disciplina!='/' order by disciplina asc");
        //disc = q.list();//zbog ovog distinct i uzimanja samo jedne kolone, mozes u index da koristis samo discItem
        tr.commit();
    } catch (HibernateException e) {
        if (tr != null) {
            tr.rollback();
        }
    } finally {
        session.close();
    }
    return disc;
}

From source file:it.geosdi.era.server.dao.hibernate.DAOUtenteHibernate.java

License:Open Source License

@Transactional(propagation = Propagation.SUPPORTS)
public List<Utente> findAll() throws DAOException {
    return findByCriteria(Restrictions.ne("userName", "test"));
}