Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<User> searchAllUsers(String searchby, String search) {
- Session session = getSessionFactory().getCurrentSession();
- session.beginTransaction();
- List<User> result = session.createQuery("from User where "+searchby+"='"+search+"'").list();
- session.getTransaction().commit();
- return result;
- }
- public static User searchLogin(String username, String password) {
- Session session = getSessionFactory().getCurrentSession();
- session.beginTransaction();
- List<User> result = session.createQuery("from User where username='"+username+"' and password='"+password+"'").list();
- session.getTransaction().commit();
- return (result.size() == 0) ? null : result.get(0);
- }
- Session session = getSessionFactory().getCurrentSession();
- session.beginTransaction();
- // operation
- session.getTransaction().commit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement