Skip to content

Instantly share code, notes, and snippets.

@syst3mw0rm
Created August 22, 2013 09:27
Show Gist options
  • Save syst3mw0rm/6305062 to your computer and use it in GitHub Desktop.
Save syst3mw0rm/6305062 to your computer and use it in GitHub Desktop.
public List<Tweet> fetchOlderFeeds(Long user_id, Long tweet_id) {
List<Tweet> tweetList = jdbcTemplate.query("select t.* from tweet t INNER JOIN following f ON (f.user_id2 = t.user_id) " +
"WHERE t.tweet_id < ? AND f.user_id1 = ? " +
"UNION ALL SELECT * FROM tweet t WHERE t.user_id=? AND t.tweet_id < ? " +
"ORDER BY tweet_id desc limit 15",
new Object[]{tweet_id, user_id, user_id, tweet_id}, new BeanPropertyRowMapper<>(Tweet.class));
return tweetList;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment