Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- java.lang.NullPointerException
- at stds.jsf.UnitController.CreateDataModel(UnitController.java:119)
- at stds.jsf.UnitController.getItems(UnitController.java:112)
- public DataModel CreateDataModel (){
- return new ListDataModel(Dao.getAllUnits());
- }
- public DataModel getItems() {
- if (items == null) {
- items = CreateDataModel();
- } else {
- }
- return items;
- }
- public List<Unit> getAllUnits() {
- List<Unit> units = null;
- Transaction trns = null;
- Session session = HibernateUtil.getSessionFactory().openSession();
- try {
- trns = session.beginTransaction();
- units = session.createQuery("From Unit").list();
- } catch (RuntimeException e) {
- e.printStackTrace();
- } finally {
- session.flush();
- session.close();
- }
- return units;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement