List of usage examples for org.hibernate Session setCacheMode
void setCacheMode(CacheMode cacheMode);
From source file:com.sap.data.db.dao.BapiFUPARAREFDao.java
public List<BapiFUPARAREFPojo> select() throws NotFoundException { List<BapiFUPARAREFPojo> list = null; Session session = null; try {/* www .j a v a 2 s. co m*/ session = HibernateUtil.getSession(); session.setCacheMode(CacheMode.GET); list = session.createCriteria("BapiFUPARAREFPojo").addOrder(Order.asc("id.FUNCNAME")) .addOrder(Order.asc("id.R3STATE")).addOrder(Order.asc("id.PARAMETER")) .addOrder(Order.asc("id.PARAMTYPE")).addOrder(Order.asc("PPOSITION")).list(); } catch (HibernateException ex) { Logger.getLogger(BapiFUPARAREFDao.class.getName()).log(Level.SEVERE, null, ex); throw new NotFoundException(ex.getMessage()); } finally { HibernateUtil.close(session); } return list; }
From source file:com.sap.data.db.dao.BapiFUPARAREFDao.java
public String selectParameterStructure(String funcName, String parameter) throws NotFoundException { String structure = null;/* w w w . ja va 2 s. co m*/ Session session = null; try { String sql = "select distinct(rbp.STRUCTURE) from BapiFUPARAREFPojo rbp where rbp.id.FUNCNAME =:FUNCNAME and rbp.id.PARAMETER =:PARAMETER"; session = HibernateUtil.getSession(); session.setCacheMode(CacheMode.GET); Query query = session.createQuery(sql); query.setString("FUNCNAME", funcName); query.setString("PARAMETER", parameter); structure = (String) query.uniqueResult(); } catch (HibernateException ex) { Logger.getLogger(BapiDD03LDao.class.getName()).log(Level.SEVERE, null, ex); throw new NotFoundException(ex.getMessage()); } finally { HibernateUtil.close(session); } return structure; }
From source file:com.sap.data.db.dao.BapiFUPARAREFDao.java
public List<BapiFUPARAREFPojo> selectInputParameters(String funcName) throws NotFoundException { List<BapiFUPARAREFPojo> list = null; Session session = null; try {//from w w w . j av a2s. c om session = HibernateUtil.getSession(); session.setCacheMode(CacheMode.GET); list = session.createCriteria("BapiFUPARAREFPojo").add(Restrictions.eq("id.FUNCNAME", funcName)) .add(Restrictions.eq("id.PARAMTYPE", "I")).addOrder(Order.asc("id.FUNCNAME")) .addOrder(Order.asc("id.R3STATE")).addOrder(Order.asc("id.PARAMETER")) .addOrder(Order.asc("id.PARAMTYPE")).addOrder(Order.asc("PPOSITION")).list(); } catch (HibernateException ex) { Logger.getLogger(BapiFUPARAREFDao.class.getName()).log(Level.SEVERE, null, ex); throw new NotFoundException(ex.getMessage()); } finally { HibernateUtil.close(session); } return list; }
From source file:com.sap.data.db.dao.BapiFUPARAREFDao.java
public List<BapiFUPARAREFPojo> selectTabParameters(String funcName) throws NotFoundException { List<BapiFUPARAREFPojo> list = null; Session session = null; try {/*from w w w.ja v a2s .co m*/ session = HibernateUtil.getSession(); session.setCacheMode(CacheMode.GET); list = session.createCriteria("BapiFUPARAREFPojo").add(Restrictions.eq("id.FUNCNAME", funcName)) .add(Restrictions.eq("id.PARAMTYPE", "T")).addOrder(Order.asc("id.FUNCNAME")) .addOrder(Order.asc("id.R3STATE")).addOrder(Order.asc("id.PARAMETER")) .addOrder(Order.asc("id.PARAMTYPE")).addOrder(Order.asc("PPOSITION")).list(); } catch (HibernateException ex) { Logger.getLogger(BapiFUPARAREFDao.class.getName()).log(Level.SEVERE, null, ex); throw new NotFoundException(ex.getMessage()); } finally { HibernateUtil.close(session); } return list; }
From source file:com.sap.data.db.dao.BapiFUPARAREFDao.java
public List<BapiFUPARAREFPojo> selectParameters(String funcName) throws NotFoundException { List<BapiFUPARAREFPojo> list = null; Session session = null; try {//from ww w. j a va 2 s.co m session = HibernateUtil.getSession(); session.setCacheMode(CacheMode.GET); list = session.createCriteria("BapiFUPARAREFPojo").add(Restrictions.eq("id.FUNCNAME", funcName)) .addOrder(Order.asc("id.FUNCNAME")).addOrder(Order.asc("id.R3STATE")) .addOrder(Order.asc("id.PARAMETER")).addOrder(Order.asc("id.PARAMTYPE")) .addOrder(Order.asc("PPOSITION")).list(); } catch (HibernateException ex) { Logger.getLogger(BapiFUPARAREFDao.class.getName()).log(Level.SEVERE, null, ex); throw new NotFoundException(ex.getMessage()); } finally { HibernateUtil.close(session); } return list; }
From source file:com.sap.data.db.dao.BapiFUPARAREFDao.java
public List<BapiFUPARAREFPojo> selectETParameters(String funcName) throws NotFoundException { List<BapiFUPARAREFPojo> list = null; Session session = null; try {/*from www . ja va2s . c o m*/ session = HibernateUtil.getSession(); session.setCacheMode(CacheMode.GET); list = session.createCriteria("BapiFUPARAREFPojo").add(Restrictions.eq("id.FUNCNAME", funcName)) .add(Restrictions.in("id.PARAMTYPE", new Object[] { "E", "T" })) .add(Restrictions.sqlRestriction("STRUCTURE not like('%-%')")) .addOrder(Order.asc("id.FUNCNAME")).addOrder(Order.asc("id.R3STATE")) .addOrder(Order.asc("id.PARAMETER")).addOrder(Order.asc("id.PARAMTYPE")) .addOrder(Order.asc("PPOSITION")).list(); } catch (HibernateException ex) { Logger.getLogger(BapiFUPARAREFDao.class.getName()).log(Level.SEVERE, null, ex); throw new NotFoundException(ex.getMessage()); } finally { HibernateUtil.close(session); } return list; }
From source file:com.sap.data.db.dao.BapiFUPARAREFDao.java
public BapiFUPARAREFPojo selectParameter(String funcName, String parameter) throws NotFoundException { BapiFUPARAREFPojo pojo = null;/* w w w . j a va 2s .c om*/ Session session = null; try { session = HibernateUtil.getSession(); session.setCacheMode(CacheMode.GET); pojo = (BapiFUPARAREFPojo) session.createCriteria("BapiFUPARAREFPojo") .add(Restrictions.eq("id.FUNCNAME", funcName)).add(Restrictions.eq("id.PARAMETER", parameter)) .addOrder(Order.asc("id.FUNCNAME")).addOrder(Order.asc("id.R3STATE")) .addOrder(Order.asc("id.PARAMETER")).addOrder(Order.asc("id.PARAMTYPE")) .addOrder(Order.asc("PPOSITION")).setMaxResults(1).uniqueResult(); } catch (HibernateException ex) { Logger.getLogger(BapiFUPARAREFDao.class.getName()).log(Level.SEVERE, null, ex); throw new NotFoundException(ex.getMessage()); } finally { HibernateUtil.close(session); } return pojo; }
From source file:com.sap.data.db.dao.BapiFUPARAREFDao.java
public List<BapiFUPARAREFPojo> selectParameters(String funcName, String paramType) throws NotFoundException { List<BapiFUPARAREFPojo> list = null; Session session = null; try {//from www.j a v a2 s . com session = HibernateUtil.getSession(); session.setCacheMode(CacheMode.GET); list = session.createCriteria("BapiFUPARAREFPojo").add(Restrictions.eq("id.FUNCNAME", funcName)) .add(Restrictions.eq("id.PARAMTYPE", paramType)).addOrder(Order.asc("id.FUNCNAME")) .addOrder(Order.asc("id.R3STATE")).addOrder(Order.asc("id.PARAMETER")) .addOrder(Order.asc("id.PARAMTYPE")).addOrder(Order.asc("PPOSITION")).list(); } catch (HibernateException ex) { Logger.getLogger(BapiFUPARAREFDao.class.getName()).log(Level.SEVERE, null, ex); throw new NotFoundException(ex.getMessage()); } finally { HibernateUtil.close(session); } return list; }
From source file:com.sap.data.db.dao.EventDao.java
public List<EventPojo> select() throws NotFoundException { List<EventPojo> list = null; Session session = null; try {//from w w w . j av a 2 s. com session = HibernateUtil.getSession(); session.setCacheMode(CacheMode.GET); list = session.createCriteria("EventPojo").add(Restrictions.eq("DELETIONFLAG", "1")) .addOrder(Order.desc("EVENT_ID")).list(); } catch (HibernateException ex) { Logger.getLogger(EventDao.class.getName()).log(Level.SEVERE, null, ex); throw new NotFoundException(ex.getMessage()); } finally { HibernateUtil.close(session); } return list; }
From source file:com.sap.data.db.dao.EventDao.java
private EventPojo selectMaxEvent() throws NotFoundException { List<EventPojo> list = null; Session session = null; try {// ww w . j ava 2s. com session = HibernateUtil.getSession(); session.setCacheMode(CacheMode.GET); list = session.createCriteria("EventPojo").addOrder(Order.desc("EVENT_ID")).list(); } catch (HibernateException ex) { Logger.getLogger(EventDao.class.getName()).log(Level.SEVERE, null, ex); throw new NotFoundException(ex.getMessage()); } finally { HibernateUtil.close(session); } if (list != null && !list.isEmpty()) { return list.get(0); } else { return null; } }