Index: src/main/java/it/finki/tinki/service/impl/MatchmakerServiceImpl.java
===================================================================
--- src/main/java/it/finki/tinki/service/impl/MatchmakerServiceImpl.java	(revision a8e8545fbb925011b0c4a0caca431f75dd992361)
+++ src/main/java/it/finki/tinki/service/impl/MatchmakerServiceImpl.java	(revision b24fe9b3e02b1e3bc4d7071998208dfd360c3bfd)
@@ -42,12 +42,12 @@
     @Override
     public List<Internship> getMatchingInternshipsForUser(User user) {
-        List<Match> matches = this.matchRepository.getAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user.getId(), WorkType.INTERNSHIP);
-//        List<Match> matches = this.matchRepository.getAllByUserIdAndTypeOrderByCoefficientDesc(user.getId(), WorkType.INTERNSHIP);
+        List<Match> matches = this.matchRepository.findAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user, WorkType.INTERNSHIP);
 
         List<Internship> internships = new ArrayList<>();
-        matches.forEach(match -> {
-            internships.add((Internship) match.getEmbeddedMatchId().getWork());
-//            internships.add(this.internshipRepository.findById(match.getWorkId()).get());
-        });
+        if(matches.size()!=0){
+            matches.forEach(match -> {
+                internships.add((Internship) match.getEmbeddedMatchId().getWork());
+            });
+        }
 
         return internships;
@@ -56,12 +56,12 @@
     @Override
     public List<Job> getMatchingJobsForUser(User user) {
-        List<Match> matches = this.matchRepository.getAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user.getId(), WorkType.INTERNSHIP);
-//        List<Match> matches = this.matchRepository.getAllByUserIdAndTypeOrderByCoefficientDesc(user.getId(), WorkType.JOB);
+        List<Match> matches = this.matchRepository.findAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user, WorkType.JOB);
 
         List<Job> jobs = new ArrayList<>();
-        matches.forEach(match -> {
-            jobs.add((Job) match.getEmbeddedMatchId().getWork());
-//            jobs.add(this.jobRepository.findById(match.getWorkId()).get());
-        });
+        if(matches.size()!=0) {
+            matches.forEach(match -> {
+                jobs.add((Job) match.getEmbeddedMatchId().getWork());
+            });
+        }
 
         return jobs;
@@ -70,12 +70,12 @@
     @Override
     public List<Project> getMatchingProjectsForUser(User user) {
-        List<Match> matches = this.matchRepository.getAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user.getId(), WorkType.INTERNSHIP);
-//        List<Match> matches = this.matchRepository.getAllByUserIdAndTypeOrderByCoefficientDesc(user.getId(), WorkType.PROJECT);
+        List<Match> matches = this.matchRepository.findAllByEmbeddedMatchIdUserAndTypeOrderByCoefficientDesc(user, WorkType.PROJECT);
 
         List<Project> projects = new ArrayList<>();
-        matches.forEach(match -> {
-            projects.add((Project) match.getEmbeddedMatchId().getWork());
-//            projects.add(this.projectRepository.findById(match.getWorkId()).get());
-        });
+        if(matches.size()!=0) {
+            matches.forEach(match -> {
+                projects.add((Project) match.getEmbeddedMatchId().getWork());
+            });
+        }
 
         return projects;
@@ -92,5 +92,4 @@
             EmbeddedMatchId embeddedMatchId = new EmbeddedMatchId(job, user);
             Match m = new Match(embeddedMatchId, coef, WorkType.JOB);
-//            Match m = new Match(job.getId(), user.getId(), coef, WorkType.JOB);
             this.matchRepository.save(m);
         }
@@ -107,5 +106,4 @@
             EmbeddedMatchId embeddedMatchId = new EmbeddedMatchId(project, user);
             Match m = new Match(embeddedMatchId, coef, WorkType.PROJECT);
-//            Match m = new Match(project.getId(), user.getId(), coef, WorkType.JOB);
             this.matchRepository.save(m);
         }
@@ -122,5 +120,4 @@
             EmbeddedMatchId embeddedMatchId = new EmbeddedMatchId(internship, user);
             Match m = new Match(embeddedMatchId, coef, WorkType.PROJECT);
-//            Match m = new Match(internship.getId(), user.getId(), coef, WorkType.JOB);
             this.matchRepository.save(m);
         }
