示例#1
0
 @SuppressWarnings("unchecked")
 @Override
 public List<Color> getAllColors() {
   Session session = dbHandler.getSessionFactory().openSession();
   String queryString = "from Color c order by c.price";
   Query query = session.createQuery(queryString);
   List<Color> cols = (List<Color>) query.list();
   session.close();
   return cols;
 }
示例#2
0
 @SuppressWarnings("unchecked")
 @Override
 public List<CarModel> getAllCarModels() {
   Session session = dbHandler.getSessionFactory().openSession();
   String queryString = "from CarModel m order by m.price";
   Query query = session.createQuery(queryString);
   List<CarModel> models = (List<CarModel>) query.list();
   session.close();
   return models;
 }
示例#3
0
 @Override
 public Color getColor(String name) {
   Session session = dbHandler.getSessionFactory().openSession();
   String queryString = "from Color where name = :name";
   Query query = session.createQuery(queryString);
   query.setParameter("name", name);
   Color c = (Color) query.uniqueResult();
   session.close();
   return c;
 }
示例#4
0
 @Override
 public CarModel getCarModel(String name) {
   Session session = dbHandler.getSessionFactory().openSession();
   String queryString = "from CarModel where name = :name";
   Query query = session.createQuery(queryString);
   query.setParameter("name", name);
   CarModel m = (CarModel) query.uniqueResult();
   session.close();
   return m;
 }
示例#5
0
 @Override
 public void delete(Color c) {
   dbHandler.delete(c);
 }
示例#6
0
 @Override
 public void update(Color c) {
   dbHandler.update(c);
 }
示例#7
0
 @Override
 public void create(Color c) {
   dbHandler.create(c);
 }
示例#8
0
 @Override
 public void delete(CarModel m) {
   dbHandler.delete(m);
 }
示例#9
0
 @Override
 public void update(CarModel m) {
   dbHandler.update(m);
 }
示例#10
0
 @Override
 public void create(CarModel m) {
   dbHandler.create(m);
 }