Advertisement
Guest User

Untitled

a guest
Jul 14th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. class Dao {
  2. public List<MyTable> getNewRows() throws Exception {
  3. Session session = null;
  4. List<MyTable> result;
  5. try {
  6. session = HibernateUtil.getSessionFactory().openSession();
  7. result = session.createQuery("from MyTable where state = 0 ").list();
  8. } catch (Exception e) {
  9. throw e;
  10. } finally {
  11. session.close();
  12. }
  13. return result;
  14. }
  15. }
  16.  
  17. <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/db</property>
  18. <property name="hibernate.connection.username">login</property>
  19. <property name="hibernate.connection.password">pass</property>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement