@Test public void testExecute() { List<List<Long>> results = mapper.execute(Arrays.asList(USER_ID)); assertEquals(1, results.size()); assertEquals(1, results.get(0).size()); assertEquals(new Long(ACTIVITY_ID), results.get(0).get(0)); }
@SuppressWarnings("unchecked") public List<List<Long>> execute(final List<Long> userIds) { List<List<Long>> results = new ArrayList<List<Long>>(); for (long userId : userIds) { Query q = getEntityManager().createQuery( "SELECT la.pk.activityId FROM LikedActivity la WHERE la.pk.personId = :id " + "ORDER BY la.pk.activityId DESC").setParameter("id", userId); results.add(q.getResultList()); } return results; }
GetLikedActivityIdsByUserIdsDbMapper extends BaseArgDomainMapper<List<Long>, List<List<Long>>> { @SuppressWarnings("unchecked") public List<List<Long>> execute(final List<Long> userIds) { List<List<Long>> results = new ArrayList<List<Long>>(); for (long userId : userIds) { Query q = getEntityManager().createQuery( "SELECT la.pk.activityId FROM LikedActivity la WHERE la.pk.personId = :id " + "ORDER BY la.pk.activityId DESC").setParameter("id", userId); results.add(q.getResultList()); } return results; } }
GetLikedActivityIdsByUserIdsDbMapper extends BaseArgDomainMapper<List<Long>, List<List<Long>>> { @SuppressWarnings("unchecked") public List<List<Long>> execute(final List<Long> userIds) { List<List<Long>> results = new ArrayList<List<Long>>(); for (long userId : userIds) { Query q = getEntityManager().createQuery( "SELECT la.pk.activityId FROM LikedActivity la WHERE la.pk.personId = :id " + "ORDER BY la.pk.activityId DESC").setParameter("id", userId); results.add(q.getResultList()); } return results; }  }
GetLikedActivityIdsByUserIdsDbMapper extends BaseArgDomainMapper<List<Long>, List<List<Long>>> { @SuppressWarnings("unchecked") public List<List<Long>> execute(final List<Long> userIds) { List<List<Long>> results = new ArrayList<List<Long>>(); for (long userId : userIds) { Query q = getEntityManager().createQuery( "SELECT la.pk.activityId FROM LikedActivity la WHERE la.pk.personId = :id " + "ORDER BY la.pk.activityId DESC").setParameter("id", userId); results.add(q.getResultList()); } return results; }  @SuppressWarnings("unchecked") List<List<Long>> execute(final List<Long> userIds); }
GetLikedActivityIdsByUserIdsDbMapper extends BaseArgDomainMapper<List<Long>, List<List<Long>>> { @SuppressWarnings("unchecked") public List<List<Long>> execute(final List<Long> userIds) { List<List<Long>> results = new ArrayList<List<Long>>(); for (long userId : userIds) { Query q = getEntityManager().createQuery( "SELECT la.pk.activityId FROM LikedActivity la WHERE la.pk.personId = :id " + "ORDER BY la.pk.activityId DESC").setParameter("id", userId); results.add(q.getResultList()); } return results; }  @SuppressWarnings("unchecked") List<List<Long>> execute(final List<Long> userIds);  }