/* * (non-Javadoc) * * @see dal.SchoolDAL#delete(models.School) */ @Override public int delete(School school) { final PreparedStatement statement = session.prepare("DELETE FROM school WHERE school_id = ?"); final BoundStatement boundStatement = statement.bind(school.getSchoolId()); try { session.executeAsync(boundStatement); } catch (Exception e) { return 0; } return 1; }
/* * (non-Javadoc) * * @see dal.SchoolDAL#save(models.School) */ @Override public School save(School school) { final PreparedStatement statement = session.prepare( "INSERT INTO student_info.school (school_id,name,address,email,gender_type) " + "VALUES (?,?,?,?,?)"); final BoundStatement boundStatement = statement.bind( school.getSchoolId(), school.getName(), school.getAddress(), school.getEmail(), school.getGenderType()); final ResultSetFuture savedSchoolFuture = session.executeAsync(boundStatement); // final Row response = savedSchoolFuture.getUninterruptibly().one(); return school; }