public static void insertTweet(Status tweet) throws SQLException { try { System.out.println(tweet.getCreatedAt() + ": " + tweet.getText()); if (tweet.getRetweetedStatus() != null) { insertRetweet(tweet); return; } PreparedStatement insertTweetStmt = SqlHelper.getInsertTweetStmt(); insertTweetStmt.setLong(1, tweet.getId()); if (tweet.getGeoLocation() != null) { insertTweetStmt.setFloat(2, (float) tweet.getGeoLocation().getLatitude()); insertTweetStmt.setFloat(3, (float) tweet.getGeoLocation().getLongitude()); } else { insertTweetStmt.setFloat(2, 0); insertTweetStmt.setFloat(3, 0); } insertTweetStmt.setString(4, tweet.getText()); insertTweetStmt.setInt(5, (int) tweet.getRetweetCount()); insertTweetStmt.setTimestamp(6, new Timestamp(tweet.getCreatedAt().getTime())); insertTweetStmt.setLong(7, tweet.getInReplyToStatusId()); insertTweetStmt.setLong(8, tweet.getUser().getId()); insertTweetStmt.executeUpdate(); } catch (MySQLIntegrityConstraintViolationException e) { // ignore, this is just a duplicate tweet entry, that's rather normal } }