I am using spring-data JpaRepository. I have the following native query :
@Query(value = "SELECT SUBSTRING_INDEX(u.email, '@', -1) as domain, COUNT(*) as domainCount, r.invite_organization_id"
+ " FROM srs_users as u,srs_user_registrations as r where u.user_id=r.user_id and r.invite_organization_id=:orgId"
+ " GROUP BY "
+ "SUBSTRING_INDEX(u.email, '@', -1) ORDER BY domainCount DESC", nativeQuery = true)
List<Object[]> countTopDomain(@Param("orgId") String orgId );
Can we externalize the above native query in jpa-named-queries.properties just like other named queries.