Problems with sql

Mariadb
    @Override
    public ArrayList<String> getMessages(UUID partyUUID, int lastMessageID)
    {
        String sql = "SELECT message FROM PartyChat WHERE partyUUID = ? AND id > ?";
        ArrayList<String> messages = new ArrayList<>();
        try(Connection conn = partyDatabase.getConnection(); PreparedStatement stmt = conn.prepareStatement(sql))
        {
            stmt.setString(1, partyUUID.toString());
            stmt.setInt(2, lastMessageID);
            try(ResultSet resultSet = stmt.executeQuery())
            {
                while(resultSet.next())
                {
                    messages.add(resultSet.getString("message"));
                }
            }
        }
        catch(SQLException e)
        {
            e.printStackTrace();
            Logger.info(CoreModule.getPlugin(), "MySQLDatabase", "There was a problem while getting the messages!");
        }
        return messages;
    }

The Best thing is that it only accous like 1 out of 20 times
Was this page helpful?