Example usage for org.hibernate CacheMode IGNORE

List of usage examples for org.hibernate CacheMode IGNORE

Introduction

In this page you can find the example usage for org.hibernate CacheMode IGNORE.

Prototype

CacheMode IGNORE

To view the source code for org.hibernate CacheMode IGNORE.

Click Source Link

Document

The session will never interact with the cache, except to invalidate cache items when updates occur.

Usage

From source file:com.adsapient.shared.dao.HibernateEntityDao.java

License:Open Source License

public void updateObject(final Object obj) {
    getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            session.setCacheMode(CacheMode.IGNORE);
            session.update(obj);/* www  .  ja  va2  s .co m*/
            sendUpdateEventToAdserver(obj.getClass(), ((IMappable) obj).getId(), null);
            return obj;
        }
    });
}

From source file:com.adsapient.shared.dao.HibernateEntityDao.java

License:Open Source License

public Collection viewAll(final Class objClass) {
    return (List) getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            session.setCacheMode(CacheMode.IGNORE);
            return session.createCriteria(objClass).list();
        }//from  w  w  w .  ja v a 2s  . c  o m
    });
}

From source file:com.adsapient.shared.dao.HibernateEntityDao.java

License:Open Source License

public Collection viewAllWithOrder(final Class className, final String orderFieldName) {
    return (Collection) getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            session.setCacheMode(CacheMode.IGNORE);
            return session.createCriteria(className).addOrder(Order.asc(orderFieldName)).list();
        }//from   w w w. j  av  a2 s.c o m
    });
}

From source file:com.adsapient.shared.dao.HibernateEntityDao.java

License:Open Source License

public Collection viewWithCriteria(final Class hibernateObjectClass, final String criteriaName,
        final Object criteriaValue, final String orderField) {
    Collection coll = (Collection) getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            session.setCacheMode(CacheMode.IGNORE);
            return session.createCriteria(hibernateObjectClass)
                    .add(Expression.like(criteriaName, criteriaValue)).addOrder(Order.asc(orderField)).list();
        }//from   w  w  w.jav a 2  s .c o m
    });
    if (coll == null)
        coll = new ArrayList();
    return coll;
}

From source file:com.adsapient.shared.dao.HibernateEntityDao.java

License:Open Source License

public Collection viewWithCriteriaNot(final Class hibernateObjectClass, final String criteriaName,
        final Object criteriaValue) {
    Collection coll = (Collection) getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            session.setCacheMode(CacheMode.IGNORE);
            return session.createCriteria(hibernateObjectClass).add(Expression.ne(criteriaName, criteriaValue))
                    .list();// w  w  w . j a  va 2s .  c  o m
        }
    });
    if (coll == null)
        coll = new ArrayList();
    return coll;
}

From source file:com.adsapient.shared.dao.HibernateEntityDao.java

License:Open Source License

public Collection viewWithCriteria(final Class hibernateObjectClass, final String criteriaName1,
        final Object criteriaValue1, final String criteriaName2, final Object criteriaValue2) {
    return (Collection) getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            session.setCacheMode(CacheMode.IGNORE);
            Criteria crit = session.createCriteria(hibernateObjectClass);
            if (criteriaValue1 == null) {
                crit.add(Expression.isNull(criteriaName1));
            } else {
                crit.add(Expression.eq(criteriaName1, criteriaValue1));
            }//from   w w w . j  a v a2 s  .c  o m
            if (criteriaValue2 == null) {
                crit.add(Expression.isNull(criteriaName2));
            } else {
                crit.add(Expression.eq(criteriaName2, criteriaValue2));
            }
            return crit.list();
        }
    });
}

From source file:com.adsapient.shared.dao.HibernateEntityDao.java

License:Open Source License

public Collection viewWithCriteria(final Class hibernateObjectClass, final Object[] criteriaParams) {
    return (Collection) getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            session.setCacheMode(CacheMode.IGNORE);
            Criteria critiria = session.createCriteria(hibernateObjectClass);
            for (int i = 0; i < criteriaParams.length; i += 2) {
                critiria.add(Expression.eq((String) criteriaParams[i], criteriaParams[i + 1]));
            }//w  w w. j a  va  2  s .c  om
            return critiria.list();
        }
    });
}

From source file:com.adsapient.shared.dao.HibernateEntityDao.java

License:Open Source License

public Collection viewWithNullCriteria(final Class hibernateObjectClass, final String criteriaName,
        final boolean isNull) {
    return (Collection) getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            session.setCacheMode(CacheMode.IGNORE);
            Criteria critiria = session.createCriteria(hibernateObjectClass);
            if (isNull)
                critiria.add(Expression.isNull(criteriaName));
            else/*from   ww  w.j  a va  2  s. c o m*/
                critiria.add(Expression.isNotNull(criteriaName));
            return critiria.list();
        }
    });
}

From source file:com.adsapient.shared.dao.HibernateEntityDao.java

License:Open Source License

public List getBannerList(final Integer status) {
    return (List) getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            session.setCacheMode(CacheMode.IGNORE);
            Query query = session.getNamedQuery("loadBanners").setInteger("STATUS", status);
            return query.list();
        }/*from w  w w.ja  va 2s .co  m*/
    });
}

From source file:com.adsapient.shared.dao.HibernateEntityDao.java

License:Open Source License

public Integer executeQueryUpdate(final String queryName) {
    return (Integer) getHibernateTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException {
            session.setCacheMode(CacheMode.IGNORE);
            Transaction tx = session.beginTransaction();
            Query query = session.getNamedQuery(queryName);
            Integer res = query.executeUpdate();
            tx.commit();//from w  ww  .  ja va2  s .  com
            return res;
        }
    });
}