コード例 #1
0
ファイル: BuildingDAO.java プロジェクト: jjkrol/proz
 /**
  * Gets the all buildings.
  *
  * @return the all buildings
  */
 public List<Building> getAllBuildings() {
   Session session = HibernateUtil.getSession();
   List<Building> buildings = null;
   try {
     buildings = session.createQuery("from Building").list();
   } catch (HibernateException e) {
     logger.warn(e.getMessage());
   }
   return buildings;
 }
コード例 #2
0
ファイル: BuildingDAO.java プロジェクト: jjkrol/proz
 /**
  * Gets the building by id.
  *
  * @param id the id
  * @return the building by id
  */
 public Building getBuildingById(final int id) {
   Session session = HibernateUtil.getSession();
   Building building = null;
   try {
     // session.createQuery("from Building").list();
     building = (Building) session.load(Building.class, id);
   } catch (HibernateException e) {
     logger.warn(e.getMessage());
   }
   return building;
 }