Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. java.lang.NullPointerException
  2. at stds.jsf.UnitController.CreateDataModel(UnitController.java:119)
  3. at stds.jsf.UnitController.getItems(UnitController.java:112)
  4.  
  5. public DataModel CreateDataModel (){
  6. return new ListDataModel(Dao.getAllUnits());
  7. }
  8.  
  9. public DataModel getItems() {
  10. if (items == null) {
  11. items = CreateDataModel();
  12. } else {
  13. }
  14. return items;
  15. }
  16.  
  17. public List<Unit> getAllUnits() {
  18. List<Unit> units = null;
  19. Transaction trns = null;
  20. Session session = HibernateUtil.getSessionFactory().openSession();
  21. try {
  22. trns = session.beginTransaction();
  23. units = session.createQuery("From Unit").list();
  24. } catch (RuntimeException e) {
  25. e.printStackTrace();
  26. } finally {
  27. session.flush();
  28. session.close();
  29. }
  30. return units;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement