List of usage examples for org.hibernate.criterion Restrictions gt
public static SimpleExpression gt(String propertyName, Object value)
From source file:struts.dao.ViewBiryaniDao.java
public ArrayList execute10(OrderTable ot) { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session s = sf.openSession();/* ww w. jav a2s . co m*/ //Session s1=sf.openSession(); Transaction tx = s.beginTransaction(); //Transaction tx1= s1.beginTransaction(); Criteria q = s.createCriteria(OrderTable.class); q.add(Restrictions.gt("biryani", 0)); ArrayList<BiryaniTable> list = new ArrayList(); List<OrderTable> listl = q.list(); if (!listl.isEmpty()) { for (OrderTable bst : listl) { BiryaniTable sab = new BiryaniTable(); sab.setOrderId(bst.getOrderId()); sab.setQuantity(bst.getSandwich()); list.add(sab); //s1.save(sa); //s.save(sa); } //tx.commit(); //s1.close(); } return list; }
From source file:struts.dao.ViewBurgerDao.java
public ArrayList execute1(OrderTable ot) { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session s = sf.openSession();/*from w w w .j ava 2s.c om*/ //Session s1=sf.openSession(); Transaction tx = s.beginTransaction(); //Transaction tx1= s1.beginTransaction(); Criteria q = s.createCriteria(OrderTable.class); q.add(Restrictions.gt("burger", 0)); ArrayList<BurgerTable> list = new ArrayList(); List<OrderTable> list1 = q.list(); if (!list1.isEmpty()) { for (OrderTable st : list1) { BurgerTable sa1 = new BurgerTable(); sa1.setOrderId(st.getOrderId()); sa1.setQuantity(st.getSandwich()); list.add(sa1); //s1.save(sa); //s.save(sa); } //tx.commit(); //s1.close(); } return list; }
From source file:struts.dao.ViewDosaDao.java
public ArrayList execute8(OrderTable ot) { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session s = sf.openSession();//from w w w .java 2 s .c om //Session s1=sf.openSession(); Transaction tx = s.beginTransaction(); //Transaction tx1= s1.beginTransaction(); Criteria q = s.createCriteria(OrderTable.class); q.add(Restrictions.gt("dosa", 0)); ArrayList<DosaTable> list = new ArrayList(); List<OrderTable> listd = q.list(); if (!listd.isEmpty()) { for (OrderTable dst : listd) { DosaTable dt = new DosaTable(); dt.setOrderId(dst.getOrderId()); dt.setQuantity(dst.getSandwich()); list.add(dt); //s1.save(sa); //s.save(sa); } //tx.commit(); //s1.close(); } return list; }
From source file:struts.dao.ViewHotdogDao.java
public ArrayList execute3(OrderTable ot) { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session s = sf.openSession();/*from w w w.j av a2 s .c o m*/ //Session s1=sf.openSession(); Transaction tx = s.beginTransaction(); //Transaction tx1= s1.beginTransaction(); Criteria q = s.createCriteria(OrderTable.class); q.add(Restrictions.gt("hotdog", 0)); ArrayList<HotdogTable> list = new ArrayList(); List<OrderTable> list1 = q.list(); if (!list1.isEmpty()) { for (OrderTable st : list1) { HotdogTable sa = new HotdogTable(); sa.setOrderId(st.getOrderId()); sa.setQuantity(st.getSandwich()); list.add(sa); //s1.save(sa); //s.save(sa); } //tx.commit(); //s1.close(); } return list; }
From source file:struts.dao.ViewIdliDao.java
public ArrayList execute(OrderTable ot) { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session s = sf.openSession();/*w w w . j a v a 2 s. com*/ //Session s1=sf.openSession(); Transaction tx = s.beginTransaction(); //Transaction tx1= s1.beginTransaction(); Criteria q = s.createCriteria(OrderTable.class); q.add(Restrictions.gt("idli", 0)); ArrayList<IdliTable> list = new ArrayList(); List<OrderTable> list1 = q.list(); if (!list1.isEmpty()) { for (OrderTable st : list1) { IdliTable sa = new IdliTable(); sa.setOrderId(st.getOrderId()); sa.setQuantity(st.getSandwich()); list.add(sa); //s1.save(sa); //s.save(sa); } //tx.commit(); //s1.close(); } return list; }
From source file:struts.dao.ViewManchurianDao.java
public ArrayList execute(OrderTable ot) { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session s = sf.openSession();/* w w w . j a v a2 s. c om*/ //Session s1=sf.openSession(); Transaction tx = s.beginTransaction(); //Transaction tx1= s1.beginTransaction(); Criteria q = s.createCriteria(OrderTable.class); q.add(Restrictions.gt("manchurian", 0)); ArrayList<ManchurianTable> list = new ArrayList(); List<OrderTable> list1 = q.list(); if (!list1.isEmpty()) { for (OrderTable st : list1) { ManchurianTable sa = new ManchurianTable(); sa.setOrderId(st.getOrderId()); sa.setQuantity(st.getSandwich()); list.add(sa); //s1.save(sa); //s.save(sa); } //tx.commit(); //s1.close(); } return list; }
From source file:struts.dao.ViewNoodlesDao.java
public ArrayList execute(OrderTable ot) { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session s = sf.openSession();// w ww .j av a 2 s . c om //Session s1=sf.openSession(); Transaction tx = s.beginTransaction(); //Transaction tx1= s1.beginTransaction(); Criteria q = s.createCriteria(OrderTable.class); q.add(Restrictions.gt("noodles", 0)); ArrayList<NoodlesTable> list = new ArrayList(); List<OrderTable> list1 = q.list(); if (!list1.isEmpty()) { for (OrderTable st : list1) { NoodlesTable sa = new NoodlesTable(); sa.setOrderId(st.getOrderId()); sa.setQuantity(st.getSandwich()); list.add(sa); //s1.save(sa); //s.save(sa); } //tx.commit(); //s1.close(); } return list; }
From source file:struts.dao.ViewPizzaDao.java
public ArrayList execute2(OrderTable ot) { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session s = sf.openSession();/*from ww w . ja va 2 s. co m*/ //Session s1=sf.openSession(); Transaction tx = s.beginTransaction(); //Transaction tx1= s1.beginTransaction(); Criteria q = s.createCriteria(OrderTable.class); q.add(Restrictions.gt("pizza", 0)); ArrayList<PizzaTable> list = new ArrayList(); List<OrderTable> list1 = q.list(); if (!list1.isEmpty()) { for (OrderTable st : list1) { PizzaTable sa = new PizzaTable(); sa.setOrderId(st.getOrderId()); sa.setQuantity(st.getSandwich()); list.add(sa); //s1.save(sa); //s.save(sa); } //tx.commit(); //s1.close(); } return list; }
From source file:struts.dao.ViewSamosaDao.java
public ArrayList execute(OrderTable ot) { SessionFactory sf = new Configuration().configure().buildSessionFactory(); Session s = sf.openSession();/*from ww w . j a v a 2 s . c o m*/ //Session s1=sf.openSession(); Transaction tx = s.beginTransaction(); //Transaction tx1= s1.beginTransaction(); Criteria q = s.createCriteria(OrderTable.class); q.add(Restrictions.gt("samosa", 0)); ArrayList<SamosaTable> list = new ArrayList(); List<OrderTable> lists = q.list(); if (!lists.isEmpty()) { for (OrderTable sst : lists) { SamosaTable sat = new SamosaTable(); sat.setOrderId(sst.getOrderId()); sat.setQuantity(sst.getSandwich()); list.add(sat); //s1.save(sa); //s.save(sa); } //tx.commit(); //s1.close(); } return list; }
From source file:systemic.sif.sbpframework.persist.dao.DOCacheDAO.java
License:Apache License
/** * This method returns all objects in the cache that have remaining dependencies but have an expiry date * older than the current date and time. These are the candidates that need to either be removed or * re-requested by the agent. If there are no expired objects then an empty list is returned. * /*from ww w . ja va 2s . co m*/ * @param tx The Transaction within this method shall operate. MUST NOT BE NULL! * @param applicationId Only return expired objects for this application. * @param agentId Only return expired object that were initially cached by this agent. * * @return See description. * * @throws IllegalArgumentException Any of the parameters is null or empty. * @throws PersistenceException A database error occurred. Error is logged. */ @SuppressWarnings("unchecked") public List<DOCache> getExpiredObjects(BasicTransaction tx, String applicationId, String agentId) throws IllegalArgumentException, PersistenceException { if (StringUtils.isEmpty(applicationId) || StringUtils.isEmpty(agentId)) { throw new IllegalArgumentException( "Some of the following parameters are either null or empty: applicationId, agentId"); } try { Criteria criteria = tx.getSession().createCriteria(DOCache.class) .add(Restrictions.eq("applicationId", applicationId)).add(Restrictions.eq("agentId", agentId)) .add(Restrictions.gt("remainingDependencies", 0)) .add(Restrictions.le("expiryDate", new Date())); return criteria.list(); } catch (Exception ex) { throw new PersistenceException("Unable to retrieve list of expired Cached Objects for application = '" + applicationId + "'and agent = '" + agentId + "'.", ex); } }