public List<MovieMarkVo> getMovieAndGradeByUserId(int id) { String sql = "select m.movieId,m.movieNameOriginal,mm.movieGrade from book b, book_mark bb, user_account u, user_profile up" + " where b.bookId = bb.bookId and u.userId = bb.userId and up.userId = u.userId" + " and u.userId = ? "; List<MovieMarkVo> l_movie_vo = new ArrayList<MovieMarkVo>(); Session session = TribusHibernateSessionFactory.currentSession(); List l = session.createSQLQuery(sql).setInteger(0, id).list(); if (l != null) { Iterator itr = l.iterator(); while (itr.hasNext()) { Object[] obj = (Object[]) itr.next(); MovieMarkVo bmv = new MovieMarkVo(); bmv.setMovieId(Integer.parseInt(obj[0].toString())); bmv.setMovieNameAlias(obj[1].toString()); bmv.setMovieGrade(Integer.parseInt(obj[2].toString())); l_movie_vo.add(bmv); } } return l_movie_vo; }
public boolean Tribuscontains(List<MovieMarkVo> m1, MovieMarkVo m2) { for (MovieMarkVo movieMarkVo : m1) { if (m2.compareTo(movieMarkVo) == 0) { return true; } } return false; }