List of usage examples for org.hibernate Session flush
void flush() throws HibernateException;
From source file:com.actop.model.UserManagement.java
public UserLogin checkLogin(String un, String pw) { Session s = Connection.getSessionFactory().openSession(); Criteria c = s.createCriteria(UserLogin.class); c.add(Restrictions.eq("un", convertToBytes(un))); c.add(Restrictions.eq("pw", convertToBytes(pw))); UserLogin ul = (UserLogin) c.uniqueResult(); s.flush(); s.close();/*from ww w. jav a 2 s .co m*/ return ul; }
From source file:com.actop.model.UserManagement.java
public List<Employers> getAllEmployers() { Session s = Connection.getSessionFactory().openSession(); Criteria c = s.createCriteria(Employers.class); List<Employers> employerses = c.list(); s.flush(); s.close();/* w ww. jav a 2 s . c om*/ return employerses; }
From source file:com.actop.model.UserManagement.java
public Employers loadEmployer(int id) { Session s = Connection.getSessionFactory().openSession(); Employers e = (Employers) s.get(Employers.class, id); s.flush(); s.close();/*from w w w .j av a 2s .c om*/ return e; }
From source file:com.actop.model.UserManagement.java
public Departments saveDepartment(String dep) { Session s = Connection.getSessionFactory().openSession(); Transaction t = s.beginTransaction(); Departments d = new Departments(); try {/* w w w. j a v a 2s . co m*/ d.setDepartment(convertToBytes(dep)); s.save(d); } catch (Exception e) { t.rollback(); e.printStackTrace(); } t.commit(); s.flush(); s.close(); return d; }
From source file:com.actop.model.UserManagement.java
public Departments loadDepartment(int id) { Session s = Connection.getSessionFactory().openSession(); Departments d = (Departments) s.load(Departments.class, id); s.flush(); s.close();// w ww . j ava 2 s. c o m return d; }
From source file:com.actop.model.UserManagement.java
public List<Departments> getAllDepartments() { Session s = Connection.getSessionFactory().openSession(); Criteria c = s.createCriteria(Departments.class); List<Departments> departmentses = c.list(); s.flush(); s.close();// www .j av a 2s. co m return departmentses; }
From source file:com.actop.model.UserManagement.java
public Allowances saveAllowances(Double max, String type, Double min) { Session s = Connection.getSessionFactory().openSession(); Transaction t = s.beginTransaction(); Allowances a = new Allowances(); try {/*from ww w .ja v a2 s. c om*/ a.setAllowanceMaximum(max); a.setAllowanceType(convertToBytes(type)); a.setAllownceMinimum(min); a.setStatus(1); s.save(a); } catch (Exception e) { t.rollback(); e.printStackTrace(); } t.commit(); s.flush(); s.close(); return a; }
From source file:com.actop.model.UserManagement.java
public List<Allowances> getAllAllowance() { Session s = Connection.getSessionFactory().openSession(); Criteria c = s.createCriteria(Allowances.class); List<Allowances> allowanceses = c.list(); s.flush(); s.close();/* ww w . j a v a 2 s . c om*/ return allowanceses; }
From source file:com.actop.model.UserManagement.java
public Allowances loadAllowance(int id) { Session s = Connection.getSessionFactory().openSession(); Allowances a = (Allowances) s.load(Allowances.class, id); s.flush(); s.close();/*from www . j a v a 2 s.c o m*/ return a; }
From source file:com.actop.model.UserManagement.java
public Designation saveDesignation(Double basic, String designation, Date promoPeriod) { Session s = Connection.getSessionFactory().openSession(); Transaction t = s.beginTransaction(); Designation d = new Designation(); try {/*from w ww .j a va 2s . com*/ d.setBasicSalary(basic); d.setDesignation(convertToBytes(designation)); d.setPromotionPeriod(promoPeriod); d.setStatus(1); s.save(d); } catch (Exception e) { t.rollback(); e.printStackTrace(); } t.commit(); s.flush(); s.close(); return d; }