示例#1
0
 public static void saveChatMessage(ChatMessage chatMessage)
     throws ReflectiveOperationException, SQLException {
   try (Connection connection = ConnectionManager.getConnection()) {
     PreparedStatement statement = connection.prepareStatement(INSERT_CHAT_MESSAGE);
     Transformer.valueIntoPreparedStatement(statement, chatMessage, INSERT_CHAT_MESSAGE_ORDER);
     statement.executeUpdate();
   }
 }
示例#2
0
 public static List<ChatMessage> getChatMessageByClubId(
     Integer clubId, Integer firstIndex, Integer count)
     throws SQLException, ReflectiveOperationException {
   try (Connection connection = ConnectionManager.getConnection()) {
     PreparedStatement statement = connection.prepareStatement(SELECT_CHAT_MESSAGE_BY_CLUB_ID);
     statement.setInt(1, clubId);
     statement.setInt(2, firstIndex);
     statement.setInt(3, count);
     ResultSet resultSet = statement.executeQuery();
     return Transformer.transformResultSetIntoList(resultSet, ChatMessage.class);
   }
 }