我正在尝试使用Query方法在存储库中执行以下查询。我想要唯一的位置,结果应该是
JSON
格式(键、值)
这是我的密码
@Repository
public interface AccountRepository extends JpaRepository<Account, Integer>, QueryDslPredicateExecutor<Account> {
// Load location
@Query("select new map (distinct(a.slocation) as slocation) from Account a where a.slocation !=null")
Set<Account> findSlocation();
错误
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: distinct near line 1, column 17 [select new map (distinct(a.slocation) as slocation) from com.spacestudy.model.Account a where a.slocation !=null]
有人能告诉我如何解决这个错误吗?