アプリを使用JPAしてFacebookログインしています。ユーザーがサーバーにログインした後、各ユーザーがFacebookID でデータベースに存在するかどうかがチェックされます。毎回クエリforを実行するループを作成しました。selectこのアプローチは遅いです。より速くするためのより良い方法はありますか?
コードは
for (User friend : friends) {
User current = userManager.find(friend.facebookId);
If (null != current) { friend.setId(current.getId);}}