public List<String> readDistinctOrders() {
   if (Boolean.valueOf(AppConfig.getInstance().getProperty("screen.allorders"))) {
     sql_query = "SELECT DISTINCT ORDERID, ORDERTIME FROM ORDERS ORDER BY ORDERTIME ";
   } else {
     sql_query =
         "SELECT DISTINCT ORDERID, ORDERTIME FROM ORDERS WHERE DISPLAYID = "
             + Integer.parseInt(AppConfig.getInstance().getProperty("screen.displaynumber"))
             + " ORDER BY ORDERTIME";
   }
   SQLQuery query = HibernateUtil.getSessionFactory().openSession().createSQLQuery(sql_query);
   query.addScalar("ORDERID");
   List results = query.list();
   results = new ArrayList<String>(new LinkedHashSet<String>(results));
   return results;
 }
  public List<Orders> selectByOrderId(String orderid) {
    if (Boolean.valueOf(AppConfig.getInstance().getProperty("screen.allorders"))) {
      sql_query = "SELECT * FROM ORDERS WHERE ORDERID ='" + orderid + "' ORDER BY AUXILIARY ";
    } else {
      sql_query =
          "SELECT * FROM ORDERS WHERE ORDERID ='"
              + orderid
              + "' AND DISPLAYID = "
              + Integer.parseInt(AppConfig.getInstance().getProperty("screen.displaynumber"))
              + " ORDER BY AUXILIARY ";
    }

    SQLQuery query = HibernateUtil.getSessionFactory().openSession().createSQLQuery(sql_query);
    query.addEntity(Orders.class);
    List<Orders> results = query.list();
    return results;
  }
 public void init() {
   session = HibernateUtil.getSessionFactory().openSession();
 }