@Override public void saveOrUpdate(CourseProductItemModel model) { // TODO Auto-generated method stub try { courseProductConfigDAO.saveOrUpdate(model); } catch (DAOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Override public void removeProductsByCourse(String course) { // TODO Auto-generated method stub try { courseProductConfigDAO.execUpdateByNativeSQL( "delete from oa_course_products where course_name='" + course + "'"); } catch (DAOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@SuppressWarnings("unchecked") @Override public List<CourseProductItemModel> getProductsByCourse(String course) { // TODO Auto-generated method stub DetachedCriteria criteria = DetachedCriteria.forClass(CourseProductItemModel.class); criteria.add(Restrictions.sqlRestriction("course_name=?", course, Hibernate.STRING)); try { List<CourseProductItemModel> list = courseProductConfigDAO.getListByCriteria(criteria); courseProductConfigDAO.saveOrUpdate(list, false); return courseProductConfigDAO.getListByCriteria(criteria); } catch (DAOException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }