/**
  * ************************************GENRE
  * SECTION********************************************************************
  */
 public void createGenre(Genre genre) throws Exception {
   ConnectionUtil c = new ConnectionUtil();
   Connection conn = c.createConnection();
   try {
     if (genre == null
         || genre.getGenreName() == null
         || genre.getGenreName().length() == 0
         || genre.getGenreName().length() > 45) {
       throw new Exception("Genre Name cannot be empty or more than 45 Chars");
     } else {
       GenreDAO gdao = new GenreDAO(conn);
       gdao.create(genre);
       conn.commit();
     }
   } catch (Exception e) {
     e.printStackTrace();
     conn.rollback();
   } finally {
     conn.close();
   }
 }
예제 #2
0
 public void delete(Genre genre) throws Exception {
   save("delete from tbl_genre where genre_id = ?", new Object[] {genre.getGenreName()});
 }
예제 #3
0
 public void update(Genre genre) throws Exception {
   save(
       "update tbl_genre set genre_name = ? where genre_id = ?",
       new Object[] {genre.getGenreName()});
 }
예제 #4
0
 public void create(Genre genre) throws Exception {
   save("insert into tbl_genre (genre_name) values(?)", new Object[] {genre.getGenreName()});
 }