예제 #1
0
  public List<MusicMarkVo> getMusicAndGradeByUserId(int id) {
    String sql =
        "select m.musicId,m.musicName,mm.musicGrade from "
            + " music m, music_mark mm, user_account u, user_profile up"
            + " where m.musicId = mm.musicId and u.userId = mm.userId and up.userId = u.userId"
            + " and u.userId = ? ";

    List<MusicMarkVo> l_music_vo = new ArrayList<MusicMarkVo>();

    Session session = TribusHibernateSessionFactory.currentSession();
    List<Music> l = session.createSQLQuery(sql).setInteger(0, id).list();
    if (l != null) {
      Iterator itr = l.iterator();
      while (itr.hasNext()) {

        Object[] obj = (Object[]) itr.next();
        MusicMarkVo bmv = new MusicMarkVo();

        // bmv.setMovieId(Integer.parseInt(obj[0].toString()));
        bmv.setMusicId(Integer.parseInt(obj[0].toString()));

        bmv.setMusicName(obj[1].toString());
        // bmv.setMovieNameAlias(obj[1].toString());
        if (obj[2] == null) obj[2] = 1;
        bmv.setMusicGrade(Integer.parseInt(obj[2].toString()));
        // bmv.setMovieGrade(Integer.parseInt(obj[2].toString()));

        l_music_vo.add(bmv);
      }
    }
    return l_music_vo;
  }
예제 #2
0
 public boolean Tribuscontains(List<MusicMarkVo> m1, MusicMarkVo m2) {
   for (MusicMarkVo movieMarkVo : m1) {
     if (m2.compareTo(movieMarkVo) == 0) {
       return true;
     }
   }
   return false;
 }