-2

I have 2 different entities. table1 has a column which is primary key of table2.

both of the tables has respected repository.

If I write below query in one of the repository it gives error

QuerySyntaxException: unexpected token:

@Query("select new stats.UserCountDTO(b.objectiveId, count(b.objectiveId), a.locationCountry)"+ 
" from UserIdentityEntity a, UserObjectiveEntity b where b.userIdentityId == a.id and b.cId = ?1")

How can I write join queries in this case using spring data jpa?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Anjali
  • 1,623
  • 5
  • 30
  • 50

1 Answers1

1

You just make a mistake. The

b.userIdentityId == a.id 

should be:

b.userIdentityId = a.id
Dherik
  • 17,757
  • 11
  • 115
  • 164