java - unexpected char: '@' - Handling Pivots and Annotation with JpaRepository -


i test out sql queries using native sql, before bringing them spring jparespository files.

i (with of @curiouskid) able perform pivot table (which displays data in "excel-friendly fashion) , separate endpoint.

for brevity, display first few lines (which causing error):

com.example.demo.repositories.salesrepository

package com.example.demo.repositories;  import java.util.list;  import org.springframework.data.jpa.repository.jparepository; import org.springframework.data.jpa.repository.query; import org.springframework.stereotype.component;  import com.bofa.app.entities.sales;  @component public interface salesrepository extends jparepository<sales, long> {  @query("declare "     + "@cols nvarchar(max), "     + "@convertcols nvarchar(max), "     + "@query nvarchar(max), "  ... 

note, have several other queries aren't using declare annotations (and simple queries) working fine within repository. declare keyword isn't throwing errors well, when attempts parse first "@cols" keyword throws following error:

error creating bean name 'salesrepository': invocation of init method failed;  unexpected char: '@' [declare @cols nvarchar(max), @convertcols nvarchar(max),  @query nvarchar(max)... 

i know there several keywords have modified work spring jparepository or hibernate or jpql or hql (i think have same tolerance far sql query derivation goes).

anyone familiar 1 in order make query work? these "@col", "@query"-type declarations considered "named queries".

assistance appreciated on one. thanks.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -